Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci-lint does not return errors #1753

Closed
3 tasks done
haibin opened this issue Feb 20, 2021 · 2 comments
Closed
3 tasks done

golangci-lint does not return errors #1753

haibin opened this issue Feb 20, 2021 · 2 comments
Labels
question Further information is requested

Comments

@haibin
Copy link

haibin commented Feb 20, 2021

Thank you for creating the issue!

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.37.0 built from 34e5fc6 on 2021-02-17T10:35:09Z
Config file
$ cat .golangci.yml
cat: .golangci.yml: No such file or directory
Go environment
$ go version && go env
go version go1.15.8 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/h.liu.3/Library/Caches/go-build"
GOENV="/Users/h.liu.3/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/h.liu.3/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/h.liu.3/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.8/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.8/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/h.liu.3/git/hello-service/go.mod"
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/x1/rvk7bnq97fd6wqryjh0n6fqsdh1r5m/T/go-build654992446=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/h.liu.3/git/hello-service /Users/h.liu.3/git /Users/h.liu.3 /Users /] 
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck] 
INFO [loader] Go packages loading at mode 575 (types_sizes|deps|files|name|compiled_files|exports_file|imports) took 221.852769ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 516.063µs 
INFO [linters context/goanalysis] analyzers took 3.593564824s with top 10 stages: buildir: 2.93242973s, inspect: 179.579037ms, ctrlflow: 134.294341ms, fact_purity: 121.900125ms, fact_deprecated: 114.971886ms, printf: 95.713906ms, ineffassign: 1.106687ms, errcheck: 681.381µs, S1038: 639.43µs, S1019: 442.751µs 
INFO [linters context/goanalysis] analyzers took 37.134466ms with top 10 stages: buildir: 35.680866ms, U1000: 1.4536ms 
INFO [runner] Issues before processing: 1, after processing: 0 
INFO [runner] Processors filtering stat (out/in): skip_files: 1/1, skip_dirs: 1/1, exclude-rules: 0/1, cgo: 1/1, path_prettifier: 1/1, autogenerated_exclude: 1/1, identifier_marker: 1/1, exclude: 1/1, filename_unadjuster: 1/1 
INFO [runner] processing took 147.119µs with stages: path_prettifier: 41.34µs, autogenerated_exclude: 38.298µs, identifier_marker: 26.309µs, skip_dirs: 22.758µs, filename_unadjuster: 6.185µs, exclude-rules: 4.131µs, nolint: 2.927µs, cgo: 1.092µs, max_same_issues: 701ns, uniq_by_line: 597ns, diff: 424ns, exclude: 357ns, source_code: 337ns, max_from_linter: 335ns, severity-rules: 296ns, max_per_file_from_linter: 231ns, skip_files: 230ns, path_shortener: 220ns, sort_results: 215ns, path_prefixer: 136ns 
INFO [runner] linters took 2.770083955s with stages: goanalysis_metalinter: 2.670818501s, unused: 99.047686ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 32 samples, avg is 200.8MB, max is 274.5MB 
INFO Execution took 3.010855805s                  

golint returns the following errors but golangci-lint does not. Any idea what went wrong?

$ golint ./...
app/hello-api/main.go:21:2: var ageId should be ageID
app/hello-api/main.go:24:6: don't use underscores in Go names; var bad_name should be badName
app/hello-api/handlers/handlers.go:12:1: exported function API should have comment or be unexported
business/mid/errors.go:11:1: exported function Errors should have comment or be unexported
business/mid/logger.go:13:1: exported function Logger should have comment or be unexported
foundation/web/web.go:27:6: exported type App should have comment or be unexported
foundation/web/web.go:33:1: exported function NewApp should have comment or be unexported
foundation/web/web.go:41:6: exported type Handler should have comment or be unexported
foundation/web/web.go:43:1: exported method App.Handle should have comment or be unexported
@haibin haibin added the bug Something isn't working label Feb 20, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 20, 2021

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Feb 20, 2021
@ldez
Copy link
Member

ldez commented Feb 20, 2021

Hello,

golangci-lint applies some exclusions by default:

Independently from option exclude we use default exclude patterns,
it can be disabled by this option. To list all
excluded by default patterns execute golangci-lint run --help.
Default value for this option is true.
exclude-use-default: false

https://golangci-lint.run/usage/configuration/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants