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

could not import internal/cpu (-: could not load export data: cannot import "internal/cpu" (unknown iexport format version 1), export data is newer version - update tool) #893

Closed
3 tasks done
yansal opened this issue Dec 19, 2019 · 5 comments
Labels
bug Something isn't working dependencies Relates to an upstream dependency

Comments

@yansal
Copy link

yansal commented Dec 19, 2019

Thank you for creating the issue!

  • 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).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:16:56Z
Config file
$ golangci-lint config path
WARN No config file detected
Go environment
$ go version && go env
go version go1.14beta1 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/yann/.cache/go-build"
GOENV="/home/yann/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY="github.com/ulule/*"
GONOSUMDB="github.com/ulule/*"
GOOS="linux"
GOPATH="/home/yann/go"
GOPRIVATE="github.com/ulule/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/yann/sdk/go1.14beta1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/yann/sdk/go1.14beta1/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build756039823=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ cd $(mktemp -d)
$ cat > main.go
package main

import "fmt"

func main() {
	fmt.Println("vim-go")
}
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /tmp/tmp.Cfm36xuyQn /tmp /] 
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck] 
INFO [loader] Go packages loading at mode 575 (types_sizes|deps|exports_file|files|name|compiled_files|imports) took 72.396647ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 84.595µs 
INFO [runner/unused/goanalysis] analyzers took 29.678µs with top 10 stages: U1000: 15.231µs, buildssa: 14.447µs 
WARN [runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/tmp/tmp.Cfm36xuyQn/main.go:3:8: could not import fmt (/home/yann/sdk/go1.14beta1/src/fmt/errors.go:7:8: could not import errors (/home/yann/sdk/go1.14beta1/src/errors/wrap.go:8:2: could not import internal/reflectlite (/home/yann/sdk/go1.14beta1/src/internal/reflectlite/value.go:8:2: could not import runtime (/home/yann/sdk/go1.14beta1/src/runtime/alg.go:8:2: could not import internal/cpu (-: could not load export data: cannot import "internal/cpu" (unknown iexport format version 1), export data is newer version - update tool)))))] 
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 2.849579ms with top 10 stages: fact_deprecated: 696.048µs, inspect: 256.558µs, buildssa: 234.286µs, ctrlflow: 203.868µs, fact_purity: 199.656µs, printf: 196.927µs, SA1000: 19.86µs, S1005: 17.648µs, asmdecl: 16.062µs, S1019: 14.203µs 
WARN [runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: inspect@_/tmp/tmp.Cfm36xuyQn 
INFO [runner] processing took 2.705µs with stages: max_same_issues: 503ns, diff: 307ns, skip_dirs: 297ns, max_from_linter: 237ns, filename_unadjuster: 196ns, nolint: 173ns, cgo: 148ns, skip_files: 136ns, path_prettifier: 135ns, identifier_marker: 134ns, autogenerated_exclude: 132ns, max_per_file_from_linter: 60ns, uniq_by_line: 51ns, exclude: 51ns, source_code: 49ns, exclude-rules: 48ns, path_shortener: 48ns 
INFO [runner] linters took 648.319905ms with stages: unused: 643.908089ms, goanalysis_metalinter: 4.380376ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 9 samples, avg is 113.4MB, max is 136.1MB 
INFO Execution took 724.753556ms  

There are two warnings in the output, the first is this issue, the second looks like #827.

The issue is present for versions 1.21.0, 1.20.1 and 1.20.0. It is not present for version 1.19.1.

@ernado
Copy link
Member

ernado commented Dec 21, 2019

Hi, thank you for report.

Is it only for go1.14?

Probably we should rebuild golangci-lint with go1.14 after the release, but I'm not sure that it will help.

@tpounds tpounds added bug Something isn't working dependencies Relates to an upstream dependency labels Dec 30, 2019
@tpounds
Copy link
Contributor

tpounds commented Dec 30, 2019

I was able to reproduce with Go 1.14.x and latest master. The fix is to update x/tools to a more recent version.

cc @jirfag

@pierrre
Copy link
Contributor

pierrre commented Dec 31, 2019

Be careful, if you update to a more recent version of x/tools, it causes some issues with the govet linter.

if a.ResultType != nil {
// Skipping internal analyzers.
continue
}

This condition matches for some analyzers, such as printf, because they changed it in x/tools "recently".
If you configure the key linters-settings.govet.settings.printf in the config file, it will throw an error about unknown/invalid key.

This error occurred for me, because I was not able to run golangci-lint with Go 1.14.
So I decided to install it with go get.
I was working fine with v1.21.0, but since v1.22.0 it's broken. (due to the x/tools update)
I learned recently that it's not recommended to install golangci-lint with go get.
BTW, go get is used by vscode-go, so it's also broken now.

@tpounds
Copy link
Contributor

tpounds commented Dec 31, 2019

@pierrre Thanks for the follow up. We actually haven't updated x/tools in any releases since we are using an explicit replace directive in the go.mod. This is not carried transitively when using go get in a downstream project. Can confirm this on your end by copying the directive into your own project's go.mod file?

@pierrre
Copy link
Contributor

pierrre commented Jan 1, 2020

by copying the directive into your own project's go.mod file?

I can't do it, because I'm not using it in a project.
I'm installing it "globally" on my system.

But I'm sure that the replace is the cause.

@ernado ernado closed this as completed in c46c1b3 Feb 4, 2020
airshipbot pushed a commit to airshipit/airshipctl that referenced this issue Mar 6, 2020
The golangci-lint linter runs into issue [0] when linting airshipctl
with go1.14. This uplifts the linter to a version in which the issue is
fixed.

[0] golangci/golangci-lint#893

Change-Id: I50d3c4ab2533c1d14d01effed21906f0ef79aafc
nickolaev pushed a commit to kumahq/kuma that referenced this issue May 9, 2020
after e4d31d, the linter does nto finish its job and complains  with
"WARN [runner] Can't run linter goanalysis_metalinter" and
"export data is newer version - update tool". This is described here
golangci/golangci-lint#893. The solution is to
use newer golangci-lint, which is done here.

Signed-off-by: Nikolay Nikolaev <[email protected]>
nickolaev pushed a commit to kumahq/kuma that referenced this issue May 11, 2020
after e4d31d, the linter does nto finish its job and complains  with
"WARN [runner] Can't run linter goanalysis_metalinter" and
"export data is newer version - update tool". This is described here
golangci/golangci-lint#893. The solution is to
use newer golangci-lint, which is done here.

Signed-off-by: Nikolay Nikolaev <[email protected]>
nickolaev pushed a commit to kumahq/kuma that referenced this issue May 11, 2020
* chore(*) bump gloangci-lint version

after e4d31d, the linter does not finish its job and complains  with
"WARN [runner] Can't run linter goanalysis_metalinter" and
"export data is newer version - update tool". This is described here
golangci/golangci-lint#893. The solution is to
use newer golangci-lint, which is done here.

* fix(kuma-cp) remove deprecated functin call

Go 1.14 deprecates BuildNameToCertificate as described here
golang/go#37626

Fixing the linter exposes this issue and it's fixed here.

* chore(*) cleanup dependencies `go mod tidy`

* chore(*) add more `-mod=mod` where needed

* fix(kuma-cp) fix failing linter after rebase to new k8s

Also Move the namespace creation to BeforeSuite section in k8s
store testing.

* chore(*) add tidy target for go mod maintenance

* chore(*) commit the result of the tidy

* fix(*) pushd/popd are not always available in a Makefile

Signed-off-by: Nikolay Nikolaev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Relates to an upstream dependency
Projects
None yet
Development

No branches or pull requests

4 participants