Closed
Description
I still have the same issue (but you guys closed it, which you shouldn't, because it is not fixed)
Using the new 1.24.0 with Go 1.14
Config file
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
dogsled:
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 2
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10
goconst:
min-len: 2
min-occurrences: 5
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- wrapperFunc
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- commentedOutCode
- commentFormatting
gocyclo:
min-complexity: 12
godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
- NOTE
- OPTIMIZE # marks code that should be optimized before merging
- HACK # marks hack-arounds that should be removed before merging
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/org/project
golint:
min-confidence: 0.8
govet:
# report about shadowed variables
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 120
maligned:
suggest-new: true
misspell:
locale: US, NL
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 30
prealloc:
# XXX: we don't recommend using this linter before doing performance profiling.
# For most programs usage of prealloc will be a premature optimization.
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
# True by default.
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
whitespace:
auto-fix: true
wsl:
# If true append is only allowed to be cuddled if appending value is
# matching variables, fields or types on line above. Default is true.
strict-append: true
# Allow calls and assignments to be cuddled as long as the lines have any
# matching variables, fields or types. Default is true.
allow-assign-and-call: true
# Allow multiline assignments to be cuddled. Default is true.
allow-multiline-assign: true
# Allow case blocks to end with a whitespace.
allow-case-traling-whitespace: true
# Allow declarations (var) to be cuddled.
allow-cuddle-declarations: false
linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godox
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- lll
- maligned
- misspell
- nakedret
- prealloc
- scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
#- unused
- varcheck
- whitespace
disable:
#- goanalysis_metalinter
#- maligned
#- prealloc
#- gochecknoinits
#- goimports
#- gofmt
fast: false
run:
skip-dirs:
- test/testdata_etc
build-tags:
- codeanalysis
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
# print lines of code with issue, default is true
print-issued-lines: true
# print linter name in the end of issue text, default is true
print-linter-name: true
issues:
exclude-rules:
- text: "G107:"
linters:
- gosec
- text: "weak cryptographic primitive"
linters:
- gosec
#- text: "unnecessary leading newline"
# linters:
# - whitespace
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
#service:
# golangci-lint-version: 1.15.x # use the fixed version to not introduce new linters unexpectedly
# prepare:
# - echo "here I can run custom commands, but no preparation needed for this repo"
Go environment
go version go1.14 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/marcelloh/go/bin"
GOCACHE="/Users/marcelloh/Library/Caches/go-build"
GOENV="/Users/marcelloh/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="bitbucket.org/aanzeeonline"
GONOSUMDB="bitbucket.org/aanzeeonline"
GOOS="darwin"
GOPATH="/Users/marcelloh/go"
GOPRIVATE="bitbucket.org/aanzeeonline"
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/marcelloh/data/go-business/impact/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/sw/g1d8300x5mjgfkr7c6td2pq00000gn/T/go-build853007795=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
INFO [config_reader] Config search paths: [./ /Users/marcelloh/data/go-business/impact /Users/marcelloh/data/go-business /Users/marcelloh/data /Users/marcelloh /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace]
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace]
INFO [loader] Go packages loading at mode 575 (types_sizes|name|deps|exports_file|files|imports|compiled_files) took 240.699611ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.319414ms
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 760.762635ms with top 10 stages: buildir: 156.838969ms, buildssa: 127.551009ms, gocritic: 48.135795ms, dupl: 36.867479ms, interfacer: 35.853932ms, unparam: 34.103223ms, goimports: 27.338886ms, unconvert: 19.332466ms, depguard: 18.441935ms, gosec: 16.821912ms
WARN [runner] Can't run linter goanalysis_metalinter: S1002: failed prerequisites: [(inspect@bitbucket.org/aanzeeonline/impact/compare, isgenerated@bitbucket.org/aanzeeonline/impact/compare): analysis skipped: errors in package: [/Users/marcelloh/data/go-business/impact/compare/file.go:37:19: undeclared name: Options /Users/marcelloh/data/go-business/impact/compare/file.go:49:15: undeclared name: Exec]]
INFO [runner] processing took 4.153µs with stages: max_same_issues: 2.073µs, nolint: 334ns, skip_dirs: 254ns, max_from_linter: 164ns, cgo: 139ns, autogenerated_exclude: 122ns, filename_unadjuster: 118ns, path_shortener: 118ns, skip_files: 118ns, exclude-rules: 115ns, diff: 114ns, path_prettifier: 111ns, exclude: 108ns, identifier_marker: 108ns, source_code: 53ns, uniq_by_line: 52ns, max_per_file_from_linter: 52ns
INFO [runner] linters took 309.345133ms with stages: goanalysis_metalinter: 309.257375ms
ERRO Running error: S1002: failed prerequisites: [(inspect@bitbucket.org/aanzeeonline/impact/compare, isgenerated@bitbucket.org/aanzeeonline/impact/compare): analysis skipped: errors in package: [/Users/marcelloh/data/go-business/impact/compare/file.go:37:19: undeclared name: Options /Users/marcelloh/data/go-business/impact/compare/file.go:49:15: undeclared name: Exec]]
INFO Memory: 7 samples, avg is 109.5MB, max is 138.6MB
INFO Execution took 562.48163ms
It's always on the same part. What is interesting about it, that it complains about a struct and a function not being present. They are present within the package, only not in that file.
The software compiles, so there's nothing wrong, only the linter sees that differently. :-(