Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

structcheck: false positive #2054

Closed
3 of 4 tasks
gucio321 opened this issue Jun 14, 2021 · 2 comments
Closed
3 of 4 tasks

structcheck: false positive #2054

gucio321 opened this issue Jun 14, 2021 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@gucio321
Copy link

gucio321 commented Jun 14, 2021

  • 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

Hi,
I noticed a very strange begavior of stuctcheck linter, which report false-positive on... unexpored fields of structures in some specific situations

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.40.1 built from 625445b1 on 2021-05-14T11:44:45Z
Config file
$ cat .golangci.yml
linters:
  disable-all: true
  enable:
    - structcheck
Go environment
$ go version && go env
go version go1.16.4 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/username/.cache/go-build"
GOENV="/home/username/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/username/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/username/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.4"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build418452944=/tmp/go-build -gno-record-gcc-switches"
Code example or link to a public repository

sadly, I cant find a short reproducable example here
I suppose, that this behavior is related with converting interface to stuct?...
however, here is a branch of a project, where this bug occures

@gucio321 gucio321 added the bug Something isn't working label Jun 14, 2021
@ldez
Copy link
Member

ldez commented Jun 14, 2021

Hello,

can you provide (as asked in the issue template) the output of your command? Thank you.

Are you sure that is not a duplicate? https://github.com/golangci/golangci-lint/issues?q=is%3Aissue+structcheck+in%3Atitle+is%3Aopen+false+positive

@ldez ldez added the feedback required Requires additional feedback label Jun 14, 2021
@gucio321
Copy link
Author

yes, this is a duplicate of #1517, I didn't find it, sorry

@ldez ldez added duplicate This issue or pull request already exists and removed bug Something isn't working feedback required Requires additional feedback labels Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants