Skip to content

Typecheck runs even though it is not an enabled linter #2063

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

Closed
3 of 4 tasks
ewrenn8 opened this issue Jun 16, 2021 · 6 comments
Closed
3 of 4 tasks

Typecheck runs even though it is not an enabled linter #2063

ewrenn8 opened this issue Jun 16, 2021 · 6 comments
Labels
question Further information is requested

Comments

@ewrenn8
Copy link

ewrenn8 commented Jun 16, 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

When running with golangci-lint version 1.40.0, we are seeing that, although we have explicitly disabled all linters in our config and only enabled a few, not including typecheck, the typecheck linter is still running.

Version of golangci-lint

v0.40.0

Config file
$ cat .golangci.yml
run:
  timeout: 5m
linters:
  enable:
    - goheader
    - golint
    - deadcode
    - unused
  disable-all: true
# all available settings of specific linters
linters-settings:
  goheader:
    values:
      regexp:
        copyright-year: 202[0-1]
    template-path: code-header-template.txt
issues:
  max-issues-per-linter: 0
  max-same-issues: 0
Go environment
$ go version && go env
go version go1.16.5 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/runner/.cache/go-build"
GOENV="/home/runner/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/runner/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/runner/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/hostedtoolcache/go/1.16.5/x64"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/hostedtoolcache/go/1.16.5/x64/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/runner/work/carvel-kapp-controller/carvel-kapp-controller/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-build3653466737=/tmp/go-build -gno-record-gcc-switches"

For context, this is not running with the bare binary, it is running in a github action. I opened the issue here, because the binary is reporting conflicting info and I figured that is not due to the action itself. Here are some potentially helpful links:

  1. Binary reporting it is only using 4 linters
  2. Typecheck errors even though typecheck isn't an enabled linter

If I am mistaken and this issue should be opened some place else, please let me know.

Thank you!

@ewrenn8 ewrenn8 added the bug Something isn't working label Jun 16, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 16, 2021

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Jun 16, 2021
@ldez
Copy link
Member

ldez commented Jun 16, 2021

Hello,

typecheck is not a real linter, it's a way to display compilation errors reported by the other linters.

@ldez ldez closed this as completed Jun 16, 2021
@ewrenn8
Copy link
Author

ewrenn8 commented Jun 17, 2021

I'm a bit confused, there are no compilation errors when compiling with the plain go compiler, so why is typecheck reporting that there are? Also, after investigating the errors, typecheck is reporting errors that don't actually exist, such as a named import not being used by its name, when it clearly is (potentially related issue #1921). Is there anything I can do to further investigate why these erroneous errors are being reported?

@ldez
Copy link
Member

ldez commented Jun 17, 2021

@ewrenn8 your problem is related to your vendor folder: there are some missing files.

You have to do a go mod vendor

$ golangci-lint run
WARN [runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner.  Replaced by revive. 
pkg/apiserver/client/clientset/versioned/typed/datapackaging/v1alpha1/fake/fake_package.go:30:3: c.Fake.Invokes undefined (type *FakeDataV1alpha1 has no field or method Invokes) (typecheck)
                Invokes(testing.NewGetAction(PackagesResource, c.ns, name), &v1alpha1.Package{})
                ^
...
pkg/apiserver/registry/datapackaging/package_metadata_crd_rest_test.go:22:2: "k8s.io/client-go/testing" imported but not used as cgtesting (typecheck)
        cgtesting "k8s.io/client-go/testing"
        ^
$ go mod vendor 
$ git status -sb
## go-version-bump...origin/go-version-bump
 D vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.go
 D vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.pb.go
 D vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.proto
 D vendor/github.com/googleapis/gnostic/OpenAPIv2/README.md
 D vendor/github.com/googleapis/gnostic/OpenAPIv2/openapi-2.0.json
?? vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.go
?? vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.pb.go
?? vendor/github.com/googleapis/gnostic/openapiv2/OpenAPIv2.proto
?? vendor/github.com/googleapis/gnostic/openapiv2/README.md
?? vendor/github.com/googleapis/gnostic/openapiv2/openapi-2.0.json
$ golangci-lint run
WARN [runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner.  Replaced by revive. 

@aaahrens
Copy link

aaahrens commented Aug 3, 2021

I would really appreciate this being fixed as it's seriously blocking bazel integration.

@ldez
Copy link
Member

ldez commented Aug 4, 2021

There is nothing to fix: typecheck is not real linter, it's a way to display "compilation" errors throw by linters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants