-
-
Couldn't load subscription status.
- Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't workingplatform: macosIssue that is related to MacOSIssue that is related to MacOS
Description
Welcome
- 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 read the typecheck section of the FAQ (https://golangci-lint.run/usage/faq/#why-do-you-have-typecheck-errors).
- Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)
Description of the problem
I have the following structure inside macOS temp directory (/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/ in my case):
/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go ❯ ll total 8.0K -rw-r--r-- 1 artyom staff 25 Sep 9 21:12 go.mod -rw-r--r-- 1 artyom staff 40 Sep 21 20:58 main.go main.go:
package main func main() { for { } }When I run golangci-lint run, it works okay:
/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go ❯ golangci-lint run main.go:4:2: SA5002: this loop will spin, using 100% CPU (staticcheck) for { ^ When I run golangci-lint run $PWD, resolved to golangci-lint run /var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go, same output.
Now the same directory with resolved symlink:
/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go ❯ ll /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go total 8.0K -rw-r--r-- 1 artyom staff 25 Sep 9 21:12 go.mod -rw-r--r-- 1 artyom staff 40 Sep 21 20:58 main.go Running golangci-lint run /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go produces error output:
/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go ❯ golangci-lint run /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go ERRO [linters_context] typechecking error: directory /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go outside main module or its selected dependencies Version of golangci-lint
$ golangci-lint --version golangci-lint has version 1.54.2 built with go1.21.0 from 411e0bbb on 2023-08-21T12:04:32ZConfiguration
golangci-lint run /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go golangci-lint run $PWD # golangci-lint run /var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go golangci-lint runGo environment
$ go version && go env go version go1.21.1 darwin/arm64 GO111MODULE='' GOARCH='arm64' GOBIN='' GOCACHE='/Users/artyom/Library/Caches/go-build' GOENV='/Users/artyom/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/artyom/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/artyom/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.21.1' GCCGO='gccgo' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/go-build3756480822=/tmp/go-build -gno-record-gcc-switches -fno-common'Verbose output of running
$ golangci-lint cache clean $ golangci-lint run -v /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go INFO [config_reader] Config search paths: [./ /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn /private/var/folders/p8 /private/var/folders /private/var /private / /Users/artyom] INFO [lintersdb] Active 6 linters: [errcheck gosimple govet ineffassign staticcheck unused] INFO [loader] Go packages loading at mode 575 (files|types_sizes|compiled_files|exports_file|name|deps|imports) took 16.749333ms INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 5.542µs ERRO [linters_context] typechecking error: directory /private/var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go outside main module or its selected dependencies INFO [linters_context/goanalysis] analyzers took 1.691623ms with top 10 stages: fact_deprecated: 292.625µs, buildir: 264.084µs, SA3000: 130.375µs, SA5002: 128.334µs, ctrlflow: 117.584µs, cgocall: 95.625µs, isgenerated: 91.5µs, SA4024: 73.917µs, ineffassign: 69.042µs, buildtag: 51.291µs INFO [runner] processing took 1.125µs with stages: max_same_issues: 292ns, skip_dirs: 167ns, skip_files: 125ns, nolint: 83ns, cgo: 83ns, path_prettifier: 42ns, max_per_file_from_linter: 42ns, path_prefixer: 42ns, exclude-rules: 42ns, max_from_linter: 42ns, sort_results: 42ns, identifier_marker: 41ns, exclude: 41ns, autogenerated_exclude: 41ns, filename_unadjuster: 0s, fixer: 0s, source_code: 0s, severity-rules: 0s, path_shortener: 0s, diff: 0s, uniq_by_line: 0s INFO [runner] linters took 11.187875ms with stages: goanalysis_metalinter: 11.169083ms INFO File cache stats: 0 entries of total size 0B INFO Memory: 2 samples, avg is 25.3MB, max is 27.4MB INFO Execution took 33.295ms $ golangci-lint run -v $PWD INFO [config_reader] Config search paths: [./ /var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T/try-go /var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn/T /var/folders/p8/jznrcvb54gl91s6fg50bznhm0000gn /var/folders/p8 /var/folders /var / /Users/artyom] INFO [lintersdb] Active 6 linters: [errcheck gosimple govet ineffassign staticcheck unused] INFO [loader] Go packages loading at mode 575 (compiled_files|files|imports|deps|exports_file|name|types_sizes) took 37.641792ms INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 101µs INFO [linters_context/goanalysis] analyzers took 8.925972ms with top 10 stages: fact_purity: 472.75µs, buildir: 470.833µs, SA5012: 455.417µs, typedness: 427.334µs, SA6000: 390.958µs, nilness: 371.375µs, fact_deprecated: 361.417µs, SA9003: 269.75µs, SA4006: 254.667µs, ctrlflow: 244.292µs INFO [runner] Processors filtering stat (out/in): nolint: 1/1, diff: 1/1, max_from_linter: 1/1, path_shortener: 1/1, source_code: 1/1, path_prefixer: 1/1, sort_results: 1/1, skip_dirs: 1/1, identifier_marker: 1/1, exclude-rules: 1/1, max_per_file_from_linter: 1/1, uniq_by_line: 1/1, fixer: 1/1, path_prettifier: 1/1, skip_files: 1/1, autogenerated_exclude: 1/1, exclude: 1/1, cgo: 1/1, filename_unadjuster: 1/1, max_same_issues: 1/1, severity-rules: 1/1 INFO [runner] processing took 133.125µs with stages: path_prettifier: 27.333µs, identifier_marker: 23.208µs, exclude-rules: 21.291µs, autogenerated_exclude: 17.001µs, nolint: 16µs, source_code: 11.125µs, skip_dirs: 7.542µs, filename_unadjuster: 3.333µs, uniq_by_line: 2.542µs, skip_files: 792ns, max_same_issues: 792ns, cgo: 500ns, path_shortener: 417ns, max_from_linter: 334ns, severity-rules: 209ns, exclude: 207ns, fixer: 166ns, max_per_file_from_linter: 125ns, diff: 125ns, sort_results: 83ns, path_prefixer: 0s INFO [runner] linters took 16.403084ms with stages: goanalysis_metalinter: 16.230709ms main.go:4:2: SA5002: this loop will spin, using 100% CPU (staticcheck) for { ^ INFO File cache stats: 1 entries of total size 40B INFO Memory: 2 samples, avg is 25.5MB, max is 27.7MB INFO Execution took 59.791833msA minimal reproducible example or link to a public repository
main.go:
package main func main() { for { } }go.mod:
module try-go go 1.21.1Validation
- Yes, I've included all information above (version, config, etc.).
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingplatform: macosIssue that is related to MacOSIssue that is related to MacOS