Golangci-lint: Cannot `go get` due to invalid pseudo-version

Created on 23 Sep 2019  Â·  9Comments  Â·  Source: golangci/golangci-lint

I tried to run go get to grab the latest master but running into some issues

$ go get github.com/golangci/golangci-lint/cmd/golangci-lint@master
go: finding github.com/golangci/golangci-lint master
go: finding github.com master
go: finding github.com/golangci/golangci-lint/cmd master
go: finding github.com/golangci master
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint master
go get: github.com/golangci/[email protected] requires
        github.com/goreleaser/[email protected] requires
        code.gitea.io/[email protected] requires
        github.com/go-macaron/[email protected]: invalid pseudo-version: revision is longer than canonical (6fd6a9bfe14e)

What is really weird is if I clone the repo and do go install ./cmd/golangci-lint it works perfectly fine.

Maybe I am just doing something wrong, since it looks like there is a replace in go.mod to fix this, but somehow not getting applied on go get

$ go version
go version go1.13 linux/amd64
bug

Most helpful comment

Thanks for this, I can just do GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@c427c61 and it works now.

EDIT: Oops, meant to comment in PR #736, not the issue. Oh well.

All 9 comments

See also: goreleaser/goreleaser#1145

/cc @tpounds

@howardjohn Thanks for reporting. Issue is caused by broken deps in upstream goreleaser tools. A couple of issues/pull requests have been open to fix this.

https://github.com/goreleaser/goreleaser/issues/1145
https://github.com/goreleaser/goreleaser/pull/1152
https://github.com/goreleaser/godownloader/issues/133

We should be able to fix this ASAP once the upstream issues are resolved. In the meantime, a quick and dirty hack is to pin deps using replace in your project go.mod file (e.g. https://github.com/golangci/golangci-lint/blob/master/go.mod#L52).

So...I attempted a fix with a few upstream patches, however, the github.com/go-macaron/[email protected]: invalid pseudo-version still persists. I've narrowed this down to a format discrepancy between setting GOPROXY to gocenter.io which is used by goreleaser and more permissive than the default proxy.golang.org. Unfortunately, an upstream fix is going to be a bit more involved to unwind the broken transitive dependency. To unblock downstream projects I think it will be best to create a separate tools/go.mod file to manage the project deps.

Same issue when I try to install from vscode:

Installing 1 tool at /home/pierre/go/bin
  golangci-lint

Installing github.com/golangci/golangci-lint/cmd/golangci-lint FAILED

1 tools failed to install.

golangci-lint:
Error: Command failed: /home/pierre/.gimme/versions/go1.13.src/bin/go get -v github.com/golangci/golangci-lint/cmd/golangci-lint
go get: github.com/golangci/[email protected] requires
    github.com/goreleaser/[email protected] requires
    code.gitea.io/[email protected] requires
    github.com/go-macaron/[email protected]: invalid pseudo-version: revision is longer than canonical (6fd6a9bfe14e)
go get: github.com/golangci/[email protected] requires
    github.com/goreleaser/[email protected] requires
    code.gitea.io/[email protected] requires
    github.com/go-macaron/[email protected]: invalid pseudo-version: revision is longer than canonical (6fd6a9bfe14e)

It's also broken in v1.19.0 (not only master):

âžœ  ~ GO111MODULE=on go get -v github.com/golangci/golangci-lint/cmd/[email protected] 
go: finding github.com v1.19.0
go: finding github.com/golangci v1.19.0
go: finding github.com/golangci/golangci-lint/cmd v1.19.0
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint v1.19.0
go get: github.com/golangci/[email protected] requires
    github.com/goreleaser/[email protected] requires
    code.gitea.io/[email protected] requires
    github.com/go-macaron/[email protected]: invalid pseudo-version: revision is longer than canonical (6fd6a9bfe14e)

Install works with GO111MODULE=off so you ought to be able to install it that way if you just need the binary. If you're actually using golangci-lint from another module, you should be able to fix it for your module with:

replace github.com/go-macaron/cors v0.0.0-20190309005821-6fd6a9bfe14e9 => github.com/go-macaron/cors v0.0.0-20190418220122-6fd6a9bfe14e
replace github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8 => github.com/census-instrumentation/opencensus-proto v0.0.3-0.20181214143942-ba49f56771b8

Thanks for this, I can just do GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@c427c61 and it works now.

EDIT: Oops, meant to comment in PR #736, not the issue. Oh well.

@listx Thanks for confirming the fix works for you.

Was this page helpful?
0 / 5 - 0 ratings