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

go get cmd/golangci-lint fails on Go 1.13 (tip) which uses proxy.golang.org (HTTP error 410 Gone) #595

Closed
mewmew opened this issue Jul 1, 2019 · 10 comments

Comments

@mewmew
Copy link

mewmew commented Jul 1, 2019

  1. Go environment: go version && go env

go version output:

go version devel +bc593eac2d Mon Jul 1 14:45:49 2019 +0000 linux/amd64

go env output:

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/u/.cache/go-build"
GOENV="/home/u/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/u/goget:/home/u/Desktop/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/u/go1.13"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/u/go1.13/pkg/tool/linux_amd64"
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-build741963370=/tmp/go-build -gno-record-gcc-switches"

On the latest version of Go (which uses proxy.golang.org) it seems like go get is resulting in a 410 HTTP error.

$ go get github.com/golangci/golangci-lint/cmd/golangci-lint
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint latest
verifying github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540/go.mod: github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540/go.mod: reading https://sum.golang.org/lookup/github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540: 410 Gone
@mewmew
Copy link
Author

mewmew commented Jul 1, 2019

Related to this issue, on our CI builds we've started to notice 400 HTTP error (Bad Request) reported by proxy.golang.org for the go-critic dependency of golangci-lint.

ref: https://travis-ci.org/llir/llvm/jobs/552889788

$ go get github.com/golangci/golangci-lint/cmd/golangci-lint
go: finding github.com/mattn/goveralls v0.0.2
go: downloading github.com/mattn/goveralls v0.0.2
go: extracting github.com/mattn/goveralls v0.0.2
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint latest
go: finding github.com/golangci/golangci-lint v1.17.1
go: downloading github.com/golangci/golangci-lint v1.17.1
go: extracting github.com/golangci/golangci-lint v1.17.1
go get: github.com/golangci/golangci-lint@v1.17.1 requires
	github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540: reading https://proxy.golang.org/github.com/go-critic/go-critic/@v/v0.0.0-20181204210945-1df300866540.mod: 400 Bad Request
The command "go get github.com/golangci/golangci-lint/cmd/golangci-lint" failed and exited with 1 during .

Edit: It seems like other dependencies of golangci-lint have similar issues when using proxy.golang.org:

$ go get github.com/golangci/golangci-lint/cmd/golangci-lint
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint latest
verifying github.com/golangci/ineffassign@v0.0.0-20180808204949-42439a7714cc/go.mod: github.com/golangci/ineffassign@v0.0.0-20180808204949-42439a7714cc/go.mod: reading https://sum.golang.org/lookup/github.com/golangci/ineffassign@v0.0.0-20180808204949-42439a7714cc: 410 Gone

@mewmew
Copy link
Author

mewmew commented Jul 2, 2019

It also seems that on Go 1.13 (tip), it is not possible to go get golangci-lint, even when configuring GOPROXY=direct and GOSUMDB=off.

$ GOPROXY=direct GOSUMDB=off go get github.com/golangci/golangci-lint/cmd/golangci-lint
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint latest
go: finding github.com/golangci/golangci-lint/cmd latest
go: downloading github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98
go: downloading github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540
go: downloading github.com/gogo/protobuf v1.1.1
go: downloading github.com/golangci/ineffassign v0.0.0-20180808204949-42439a7714cc
go: extracting github.com/gogo/protobuf v1.1.1
build github.com/golangci/golangci-lint/cmd/golangci-lint: cannot load github.com/go-critic/go-critic/checkers: github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)

mewmew added a commit to mewmew/ci that referenced this issue Jul 2, 2019
This is used to mitigate CI failure when go get fails
for golangci-lint (ref golangci/golangci-lint#595)
mewmew added a commit to llir/llvm that referenced this issue Jul 2, 2019
@y3llowcake
Copy link

#581

@pierrre
Copy link
Contributor

pierrre commented Jul 11, 2019

I've submitted a PR that fixes the issue
#605

@leakingtapan
Copy link

I have similar issue too:

build github.com/golangci/golangci-lint/cmd/golangci-lint: cannot load github.com/golangci/gofmt/gofmt: unexpected status (https://proxy.golang.org/github.com/golangci/gofmt/@v/v0.0.0-20181105071733-0b8337e80d98.zip): 410 Gone
Makefile:32: recipe for target 'verify' failed
make: *** [verify] Error 1
+ EXIT_VALUE=2
+ set +o xtrace

@dustmop
Copy link

dustmop commented Aug 7, 2019

Pretty sure this is the same issue, but our circleci broke earlier this week, with errors such as:

go: github.com/golangci/lint-1@v0.0.0-20180610141402-ee948d087217: unexpected status (https://proxy.golang.org/github.com/golangci/lint-1/@v/v0.0.0-20180610141402-ee948d087217.info): 410 Gone

Digging into the server response, the actual underlying problem is that the pseudo version doesn't match due to the timestamp being different. Going directly to https://proxy.golang.org/github.com/golangci/lint-1/@v/v0.0.0-20180610141402-ee948d087217.info gives:

not found: github.com/golangci/lint-1@v0.0.0-20180610141402-ee948d087217: invalid pseudo-version: does not match version-control timestamp (2019-04-20T13:22:49Z)

From what I understand, go1.13 is stricter than go1.12 about timestamps matching, and the proxy has adopted the same behavior.

I was able to work around these build problems using a series of replace statements in go.mod:

replace github.com/go-critic/go-critic v0.0.0-20181204210945-c3db6069acc5 => github.com/go-critic/go-critic v0.0.0-20190422201921-c3db6069acc5

replace github.com/go-critic/go-critic v0.0.0-20181204210945-ee9bf5809ead => github.com/go-critic/go-critic v0.0.0-20190210220443-ee9bf5809ead

replace github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6 => github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6

replace github.com/golangci/go-tools v0.0.0-20180109140146-af6baa5dc196 => github.com/golangci/go-tools v0.0.0-20190318060251-af6baa5dc196

replace github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98 => github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98

replace github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547 => github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547

replace github.com/golangci/lint-1 v0.0.0-20180610141402-ee948d087217 => github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217

@leakingtapan
Copy link

Im able to resolve the issue by setting GOPROXY=direct

@BenTheElder
Copy link

@dustmop thanks for that 🙃

for v1.17.1 I had to tweak to:

replace github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6 => github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6

replace github.com/golangci/go-tools v0.0.0-20180109140146-af6baa5dc196 => github.com/golangci/go-tools v0.0.0-20190318060251-af6baa5dc196

replace github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98 => github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98

replace github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547 => github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547

replace github.com/golangci/lint-1 v0.0.0-20180610141402-ee948d087217 => github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217

replace github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540 => github.com/go-critic/go-critic v0.0.0-20190526074819-1df300866540

replace mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34 => mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34

replace github.com/golangci/ineffassign v0.0.0-20180808204949-42439a7714cc => github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc

for master I had to add:

replace github.com/timakin/bodyclose => github.com/golangci/bodyclose v0.0.0-20190714144026-65da19158fa2

@thepudds
Copy link

thepudds commented Sep 4, 2019

Hmm. I wish I had found this about 10 minutes ago. ;-)

FWIW, using Go 1.13, these steps fail with an "invalid pseudo-version" error:

   export GOPATH=$(mktemp -d)               # using fresh module cache
   cd $(mktemp -d)                   
   go mod init example.com/tempmod     
   go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1 

which reports error:

  go: extracting github.com/golangci/golangci-lint v1.17.1
  go get: github.com/golangci/golangci-lint@v1.17.1 requires
        github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540: 
        invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)

If we follow the advice from the section of the Go 1.13 release notes on resolving version validation issues (https://golang.org/doc/go1.13#version-validation), we can make that same 'go get' work:

   # re-do setup from scratch
   export GOPATH=$(mktemp -d)               # using fresh module cache
   cd $(mktemp -d)                   
   go mod init example.com/tempmod

   # create 'replace' statements using *just* the commit hashes 
   # for each problematic module on the right-hand side
   echo 'replace github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540 => github.com/go-critic/go-critic 1df300866540' >> go.mod
   echo 'replace github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6 => github.com/golangci/errcheck ef45e06d44b6' >> go.mod
   echo 'replace github.com/golangci/go-tools v0.0.0-20180109140146-af6baa5dc196 => github.com/golangci/go-tools af6baa5dc196' >> go.mod
   echo 'replace github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98 => github.com/golangci/gofmt 0b8337e80d98' >> go.mod
   echo 'replace github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547 => github.com/golangci/gosec 66fb7fc33547' >> go.mod
   echo 'replace github.com/golangci/ineffassign v0.0.0-20180808204949-42439a7714cc => github.com/golangci/ineffassign 42439a7714cc' >> go.mod
   echo 'replace github.com/golangci/lint-1 v0.0.0-20180610141402-ee948d087217 => github.com/golangci/lint-1 ee948d087217' >> go.mod
   echo 'replace mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34 => mvdan.cc/unparam fbb59629db34' >> go.mod

This now works:

   go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1 

@jirfag
Copy link
Member

jirfag commented Sep 10, 2019

Hi, sorry for slow fixing.
Go1.13 compatibility was introduced in the latest v1.18.0 release

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

No branches or pull requests

8 participants