-
-
Couldn't load subscription status.
- Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't workingdependenciesRelates to an upstream dependencyRelates to an upstream dependency
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
gochecksumtype doesn't report missing cases if the sum type is declared in one package and the type switch is in a different package (see #3671 (comment)).
Version of golangci-lint
$ golangci-lint --version golangci-lint has version v1.55.0 built with go1.21.3 from de1c3919 on 2023-10-20T11:56:32ZConfiguration
# paste configuration file or CLI flags hereGo environment
$ go version && go env go version go1.21.3 linux/amd64 GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/root/.cache/go-build' GOENV='/root/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='local' GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.21.3' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/app/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2772357518=/tmp/go-build -gno-record-gcc-switches'Verbose output of running
$ golangci-lint cache clean $ golangci-lint run -v # paste output hereA minimal reproducible example or link to a public repository
/decl/decl.go
package decl //sumtype:decl type MySumType interface { sealed() } type VariantA struct{} func (*VariantA) sealed() {} type VariantB struct{} func (*VariantB) sealed() {}/usage/usage.go
package usage import "decl" func DoSomething(x decl.MySumType) { switch x.(type) { // <-- here is expected a report about missing VariantB case *decl.VariantA: } }Validation
- Yes, I've included all information above (version, config, etc.).
AlekSi
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdependenciesRelates to an upstream dependencyRelates to an upstream dependency