-
Welcome
Description of the problemHello.
And disabling typecheck (not shown in output) does nothing (I've read elsewhere that it cannot be disabled for not being an actual (standalone) linter). In case I'm being mistaken and this is not a bug, could you please shed some light on any trick to work around the issue? Thanks for your time already. Version of golangci-lint$ golangci-lint --version
# golangci-lint has version 1.44.0 built from 617470fa on 2022-01-25T11:31:17Z Configuration file$ cat .golangci.yml
# N/A (not using one) Go environment$ go version && go env
go version go1.16.13 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/EDITED_NAME/.cache/go-build"
GOENV="/home/EDITED_NAME/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/EDITED_NAME/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/EDITED_NAME/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.13"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/tmp/golangci-lint/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2626199701=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running$ golangci-lint cache clean
$ golangci-lint run --verbose --build-tags=debug release.go debug.go
golangci-lint run --verbose --build-tags=debug release.go debug.go
level=info msg="[config_reader] Config search paths: [ EDITED_AWAY]"
level=info msg="[lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]"
level=info msg="[loader] Using build tags: [debug]"
level=info msg="[loader] Go packages loading at mode 575 (deps|files|types_sizes|compiled_files|exports_file|imports|name) took 117.699075ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 174.489µs"
level=info msg="[linters context/goanalysis] analyzers took 2.049373ms with top 10 stages: stringintconv: 357.579µs, buildir: 289.038µs, fact_deprecated: 241.835µs, inspect: 49.431µs, S1006: 23.534µs, SA4019: 20.449µs, lostcancel: 17.971
level=info msg="[runner] Issues before processing: 326, after processing: 2"
level=info msg="[runner] Processors filtering stat (out/in): exclude: 326/326, severity-rules: 2/2, filename_unadjuster: 326/326, path_prettifier: 326/326, skip_dirs: 326/326, nolint: 326/326, diff: 2/2, max_same_issues: 2/2, path_prefix
level=info msg="[runner] processing took 9.156654ms with stages: exclude-rules: 4.600171ms, identifier_marker: 3.894568ms, path_prettifier: 307.553µs, nolint: 199.143µs, skip_dirs: 37.065µs, source_code: 32.698µs, cgo: 25.892µs, uniq_by_
level=info msg="[runner] linters took 65.386848ms with stages: goanalysis_metalinter: 56.099125ms"
debug.go:7:6: `Assert` redeclared in this block (typecheck)
func Assert(cond bool, format string, args ...interface{}) {
^
release.go:5:6: other declaration of Assert (typecheck)
func Assert(cond bool, format string, args ...interface{}) {
^
... Code example or link to a public repositorydebug.go // +build debug
package thing
import "fmt"
func Assert(cond bool, format string, args ...interface{}) {
if cond {
return
}
panic(fmt.Sprintf("Assertion failed! "+format, args...))
} release.go // +build !debug
package codec
func Assert(cond bool, format string, args ...interface{}) {
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Beta Was this translation helpful? Give feedback.
-
Hello,
If I fix the package problem, I can see your output: $ golangci-lint run --build-tags=debug release.go debug.go
debug.go:8:6: `Assert` redeclared in this block (typecheck)
func Assert(cond bool, format string, args ...interface{}) {
^
release.go:6:6: other declaration of Assert (typecheck)
func Assert(cond bool, format string, args ...interface{}) {
^ But if I don't provide explicit files, the problem disappears: $ golangci-lint run So the behavior is expected because it's the same as Go. filesrelease.go //go:build !debug
// +build !debug
package main
func Assert(cond bool, format string, args ...interface{}) {
} debug.go //go:build debug
// +build debug
package main
import "fmt"
func Assert(cond bool, format string, args ...interface{}) {
if cond {
return
}
panic(fmt.Sprintf("Assertion failed! "+format, args...))
} main.go package main
func main() {
Assert(true, "")
} $ go run . $ go run ./debug.go ./release.go
# command-line-arguments
./release.go:6:6: Assert redeclared in this block
/home/ldez/sources/go/src/github.com/golangci/sandbox/debug.go:8:47: previous declaration
|
Beta Was this translation helpful? Give feedback.
Hello,
debug.go
andrelease.go
don't have the same package (thing
,codec
) maybe it's just a mistake when you created the example.If I fix the package problem, I can see your output:
But if I don't provide explicit files, the problem disappears:
$ golangci-lint run
So the behavior is expected because it's the same as Go.
files
release.go