-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
questionFurther information is requestedFurther information is requested
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 included all information below (version, config, etc).
- Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)
Description of the problem
golangci-lint version 1.42.0 says typecheck error on Ubuntu 21.04 & Go 1.17 env
In the meantime, it works well on Windows & macOS.
A toy project is attached: https://github.com/khadmitriy/project
CMD to repro the issue:
golangci-lint run --disable-all -E staticcheck ./...
This CMD works well on Windows & macOS with Go 1.17, but says typecheck error on Ubuntu 21.04
Version of golangci-lint
Details
$ golangci-lint --version
golangci-lint has version 1.42.0 built from c6142e38 on 2021-08-17T11:47:22ZConfiguration file
Details
$ cat .golangci.yml
Config file not usedGo environment
Details
$ go version && go env
go version go1.17 linux/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/yupeng/.cache/go-build"
GOENV="/home/yupeng/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/yupeng/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/yupeng/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/yupeng/Downloads/project-master/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=/tmp/go-build2764735852=/tmp/go-build -gno-record-gcc-switches"Verbose output of running
Details
$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/yupeng/Downloads/project-master /home/yupeng/Downloads /home/yupeng /home /]
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]
INFO [loader] Go packages loading at mode 575 (deps|files|name|types_sizes|compiled_files|exports_file|imports) took 194.674048ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 927.492µs
INFO [linters context/goanalysis] analyzers took 7.687601252s with top 10 stages: buildir: 5.676072864s, inspect: 652.652782ms, printf: 269.838943ms, ctrlflow: 269.264356ms, fact_purity: 222.749299ms, nilness: 190.489302ms, fact_deprecated: 177.636696ms, typedness: 107.184266ms, SA5012: 105.989904ms, deadcode: 5.130813ms
INFO [runner/max_same_issues] 2/5 issues with text "undeclared name: `kafka`" were hidden, use --max-same-issues
INFO [runner] Issues before processing: 2079, after processing: 12
INFO [runner] Processors filtering stat (out/in): filename_unadjuster: 2079/2079, exclude: 2079/2079, nolint: 2079/2079, max_per_file_from_linter: 14/14, sort_results: 12/12, exclude-rules: 2079/2079, uniq_by_line: 14/2079, max_same_issues: 12/14, source_code: 12/12, path_shortener: 12/12, severity-rules: 12/12, path_prefixer: 12/12, cgo: 2079/2079, path_prettifier: 2079/2079, skip_files: 2079/2079, identifier_marker: 2079/2079, diff: 14/14, skip_dirs: 2079/2079, autogenerated_exclude: 2079/2079, max_from_linter: 12/12
INFO [runner] processing took 46.47657ms with stages: exclude-rules: 25.694622ms, identifier_marker: 18.418372ms, nolint: 888.248µs, path_prettifier: 842.989µs, skip_dirs: 209.36µs, uniq_by_line: 85.3µs, cgo: 82.249µs, filename_unadjuster: 68.5µs, autogenerated_exclude: 64.33µs, max_same_issues: 55.56µs, source_code: 54.89µs, path_shortener: 3.64µs, max_per_file_from_linter: 3.4µs, max_from_linter: 3.28µs, diff: 600ns, exclude: 350ns, skip_files: 320ns, sort_results: 270ns, severity-rules: 190ns, path_prefixer: 100ns
INFO [runner] linters took 3.973162839s with stages: goanalysis_metalinter: 3.926555699s
logging/logging.go:43:12: undeclared name: `sentry` (typecheck)
if err := sentry.Init(sentry.ClientOptions{
^
logging/logging.go:106:3: undeclared name: `sentry` (typecheck)
sentry.CaptureException(err) // Отправка в sentry
^
logging/logging.go:14:2: "github.com/getsentry/sentry-go" imported but not used (typecheck)
"github.com/getsentry/sentry-go"
^
Producer/Producer.go:12:13: undeclared name: `kafka` (typecheck)
var writer *kafka.Writer
^
Producer/Producer.go:17:10: undeclared name: `kafka` (typecheck)
wr := &kafka.Writer{
^
Producer/Producer.go:18:14: undeclared name: `kafka` (typecheck)
Addr: kafka.TCP(config.AppConfiguration["Kafka"].(map[string]interface{})["Url"].(string)),
^
Producer/Producer.go:5:2: "github.com/segmentio/kafka-go" imported but not used (typecheck)
"github.com/segmentio/kafka-go"
^
applicationstate/redis.go:15:18: undeclared name: `redis` (typecheck)
var redisClient *redis.Client //Клиент редиса
^
applicationstate/redis.go:18:24: undeclared name: `redis` (typecheck)
func NewRedisClient() *redis.Client {
^
applicationstate/redis.go:19:9: undeclared name: `redis` (typecheck)
return redis.NewClient(&redis.Options{
^
applicationstate/redis.go:12:2: "github.com/go-redis/redis/v8" imported but not used (typecheck)
"github.com/go-redis/redis/v8"
^
../../../../usr/local/go/src/runtime/cgo/cgo.go:34:8: could not import C (cgo preprocessing failed) (typecheck)
import "C"
^
INFO File cache stats: 4 entries of total size 8.1KiB
INFO Memory: 43 samples, avg is 242.7MB, max is 341.5MB
INFO Execution took 4.175849029sCode example or link to a public repository
Details
Demo: https://github.com/khadmitriy/projectMetadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested