Skip to content

Successful exit code (0) when typecheck error #529

@dm3ch

Description

@dm3ch

Thank you for creating the issue!

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution): golangci-lint has version 1.16.0 built from 97ea1cb on 2019-03-31T19:48:46Z
  2. Config file: cat .golangci.yml empty
  3. Go environment: go version && go env
go version go1.12.1 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dmitry.chepurovskiy/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dmitry.chepurovskiy/Workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/dmitry.chepurovskiy/.gvm/gos/go1.12.1"
GOTMPDIR=""
GOTOOLDIR="/Users/dmitry.chepurovskiy/.gvm/gos/go1.12.1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/n3/zjx8n1bd5y12gf4krlbxbp3cmgy7n2/T/go-build361798505=/tmp/go-build -gno-record-gcc-switches -fno-common"
  1. Verbose output of running: golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/dmitry.chepurovskiy/Workspace/go/src/github.com/my-organisation/my-app /Users/dmitry.chepurovskiy/Workspace/go/src/github.com/my-organisation /Users/dmitry.chepurovskiy/Workspace/go/src/github.com /Users/dmitry.chepurovskiy/Workspace/go/src /Users/dmitry.chepurovskiy/Workspace/go /Users/dmitry.chepurovskiy/Workspace /Users/dmitry.chepurovskiy /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]
INFO [lintersdb] Optimized sublinters [staticcheck gosimple unused] into metalinter megacheck
INFO [loader] Go packages loading at mode load deps types and syntax took 3.037160839s
INFO [loader] SSA repr building timing: packages building 13.88881ms, total 246.626443ms
INFO [loader/astcache] Parsed AST of all pkg.GoFiles: [] for 769ns
INFO [loader] Packages that do not compile: [github.com/my-organisation/my-app/dateranges.test]
WARN [runner/megacheck] Can't run megacheck because of compilation errors in packages [github.com/my-organisation/my-app/dateranges.test]: -:
dateranges/dateranges_test.go:40:18: missing ',' before newline in composite literal
ERRO [runner/typecheck] typechecking error:
dateranges/dateranges_test.go:40:18: missing ',' before newline in composite literal
INFO [runner] worker.3 took 6.962671ms with stages: typecheck: 5.206083ms, structcheck: 1.746699ms
INFO [runner] worker.4 took 159.532297ms with stages: deadcode: 154.615722ms, varcheck: 3.093858ms, errcheck: 1.80885ms
INFO [runner] worker.1 took 377.021335ms with stages: ineffassign: 375.597979ms, megacheck: 1.391022ms
WARN [runner/govet] govet error: assign: analysis skipped due to errors in package
WARN [runner/govet] govet error: atomicalign: analysis skipped due to errors in package
WARN [runner/govet] govet error: bools: analysis skipped due to errors in package
WARN [runner/govet] govet error: buildtag: analysis skipped due to errors in package
WARN [runner/govet] govet error: httpresponse: analysis skipped due to errors in package
WARN [runner/govet] govet error: loopclosure: analysis skipped due to errors in package
WARN [runner/govet] govet error: ctrlflow: analysis skipped due to errors in package
WARN [runner/govet] govet error: lostcancel: failed prerequisites: [email protected]/my-organisation/my-app/dateranges.test
WARN [runner/govet] govet error: nilfunc: analysis skipped due to errors in package
WARN [runner/govet] govet error: printf: analysis skipped due to errors in package
WARN [runner/govet] govet error: shift: analysis skipped due to errors in package
WARN [runner/govet] govet error: stdmethods: analysis skipped due to errors in package
WARN [runner/govet] govet error: tests: analysis skipped due to errors in package
WARN [runner/govet] govet error: unmarshal: analysis skipped due to errors in package
WARN [runner/govet] govet error: unsafeptr: analysis skipped due to errors in package
WARN [runner/govet] govet error: unusedresult: analysis skipped due to errors in package
WARN [runner/govet] govet error: buildssa: analysis skipped due to errors in package
WARN [runner/govet] govet error: nilness: failed prerequisites: [email protected]/my-organisation/my-app/dateranges.test
INFO [runner] worker.2 took 376.97477ms with stages: govet: 376.963671ms
INFO [runner] Workers idle times: #1: 682.64µs, #3: 363.272579ms, #4: 128.312551ms
WARN [runner] Can't run linter govet: asmdecl: analysis skipped due to errors in package
INFO [runner] processing took 6.804µs with stages: max_same_issues: 3.28µs, skip_dirs: 548ns, max_from_linter: 520ns, nolint: 416ns, path_prettifier: 306ns, cgo: 207ns, path_shortener: 171ns, exclude: 168ns, autogenerated_exclude: 158ns, diff: 155ns, exclude-rules: 154ns, identifier_marker: 153ns, source_code: 150ns, replacement_builder: 149ns, skip_files: 118ns, max_per_file_from_linter: 83ns, uniq_by_line: 68ns
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 37 samples, avg is 228.2MB, max is 872.7MB
INFO Execution took 3.926624789s

There's an error while linting but golangci-lint exit code is still 0.
Error:

ERRO [runner/typecheck] typechecking error:
dateranges/dateranges_test.go:40:18: missing ',' before newline in composite literal

If i right understood it works so cause of https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/typecheck.go#L49
Such errors are printed but not included into the results' list.

Snippet from the checked code that triggers this error:

	tests := []struct {
		name    string
		args    args
		want    *timestamp.Timestamp
		want1   *timestamp.Timestamp
		wantErr bool
	}{
		{
			name: "Some Name",
			args: args{
				y: "2018",
			},
			want:    start,
			want1:   end,
			wantErr: false
		},
	}

So my question does it expected behavior of linter that error doesn't cause failed exit code?
And is there any options to get this error triggers error code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions