Golangci-lint: Build errors using Go 1.13

Created on 4 Sep 2019  路  27Comments  路  Source: golangci/golangci-lint

I'm currently getting build errors (master branch) trying to build golangci-lint with Go 1.13.

The build error is:
go: github.com/golangci/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-07-14T14:40:26Z)

Here are a few details of my go env:
GOARCH=amd64
GOOS=windows

Let me know if you need any more details to reproduce.

The reason I came across this is that go get with go 1.13 returns the errors below and I thought I'd try to use a locally build version of golangci-lint.

go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
verifying github.com/golangci/[email protected]/go.mod: github.com/golangci/[email protected]/go.mod: reading https://sum.golang.org/lookup/github.com/golangci/[email protected]: 410 Gone
verifying github.com/go-critic/[email protected]/go.mod: github.com/go-critic/[email protected]/go.mod: reading https://sum.golang.org/lookup/github.com/go-critic/[email protected]: 410 Gone

bug

Most helpful comment

I've published the 1.18.0 release. Please, check that everything works

All 27 comments

Same issue here, on archlinux, when building v1.17.1.
master builds OK, though.

$ GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/[email protected]
go: finding github.com v1.17.1
go: finding github.com/golangci/golangci-lint/cmd v1.17.1
go: finding github.com/golangci v1.17.1
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint v1.17.1
go get: github.com/golangci/[email protected] requires
    github.com/go-critic/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)

Master branch doesn't build for me with go1.13 (on mac)

$ go version
go version go1.13 darwin/amd64
$ git clone [email protected]:golangci/golangci-lint.git
$ cd golangci-lint/cmd/golangci-lint
$ go build
go: github.com/go-critic/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)

There were changes in go.mod, try running go mod tidy and also setting go version to 1.13 with go mod edit -go=1.13.

Doesn't seems to work either...

$ go mod tidy
go: github.com/go-critic/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)

$ go mod edit -go=1.13

$ go mod tidy
go: github.com/go-critic/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)

$ go build
go: github.com/go-critic/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)

I'm getting the same thing

Go build gives me the same thing:
$ go build
go: github.com/go-critic/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)



Go mod tidy gives this:
$ go mod tidy
go: github.com/golangci/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-07-14T14:40:26Z)

Ok, I've been able to have the master building recreating the go.mod.

A better (less lazy) way is to look here https://github.com/golangci/golangci-lint/pull/605/commits/c3a532efb9406c70f07587f8c647b7f8ad92f676

If we follow the advice from the section of the Go 1.13 release notes on resolving聽invalid pseudo-version聽errors (https://golang.org/doc/go1.13#version-validation), we can make the go get work for v1.17.1:

 聽 # first, setup from scratch

 聽 export GOPATH=$(mktemp -d) 聽 聽 聽 聽 聽 聽 聽 # using fresh module cache
 聽 cd $(mktemp -d) 聽 聽 聽 聽 聽 聽 聽 聽 聽 
 聽 go mod init example.com/tempmod

 聽 # second, 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/[email protected]

Another way to install 1.17.1, with working --version flag like in released binaries:

GO111MODULE=off go get -d github.com/golangci/golangci-lint/cmd/golangci-lint
cd $(go env GOPATH)/src/github.com/golangci/golangci-lint
git checkout v1.17.1
go install -ldflags "-s -w -X main.version=1.17.1 -X main.commit=4ba2155 -X main.date=2019-06-10T09:06:49Z" ./cmd/golangci-lint

this should be fixed, because #605 has been merged

Not sure about that, given all of the invalid versions via the commits that prevent it from tidying:

go: github.com/golangci/[email protected]: invalid pseudo-version: does not match version-control timestamp (2018-12-23T08:41:20Z)

Most likely going to be really fixed in #670 once the CI failures show that the versions need to be regenerated, like:

diff --git a/go.mod b/go.mod
index aa462b3..0ef957e 100644
--- a/go.mod
+++ b/go.mod
@@ -14,17 +14,17 @@ require (
    github.com/golang/mock v1.0.0
    github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
    github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
-   github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6
+   github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6
    github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613
    github.com/golangci/go-tools v0.0.0-20190318055746-e32c54105b7c
    github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3
    github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee
    github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98
-   github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547
+   github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547
    github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc
-   github.com/golangci/lint-1 v0.0.0-20180610141402-ee948d087217
+   github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217
    github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca
-   github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770
+   github.com/golangci/misspell v0.3.5-0.20180809174111-950f5d19e770
    github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21
    github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0
    github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4
@@ -51,7 +51,7 @@ require (
    github.com/spf13/pflag v1.0.1
    github.com/spf13/viper v1.0.2
    github.com/stretchr/testify v1.2.2
-   github.com/timakin/bodyclose v0.0.0-00010101000000-87058b9bfcec
+   github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec
    github.com/ultraware/funlen v0.0.1
    github.com/valyala/quicktemplate v1.1.1
    golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect
@@ -62,8 +62,8 @@ require (
    gopkg.in/yaml.v2 v2.2.1
    mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
    mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
-   mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34
+   mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34
 )

 // https://github.com/golang/tools/pull/139
-replace golang.org/x/tools => github.com/golangci/tools v0.0.0-20190713050349-979bdb7f8cc8
+replace golang.org/x/tools => github.com/golangci/tools v0.0.0-20190909104219-979bdb7f8cc8

Hi!
Now GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@95d5b2c works. And today-tomorrow I will make a new release.

I've published the 1.18.0 release. Please, check that everything works

Unfortunately we're not seeing any changes in our linting - typecheck is still failing on DecodeRune, DecodeRuneInString, ValidString

@joeblubaugh can you provide more details on how to reproduce it, please?

I got the same error and figured out that's because go 1.13 is validating downloaded modules, regardless of source, against the public Go checksum database at sum.golang.org (https://golang.org/cmd/go/#hdr-Module_configuration_for_non_public_modules). So it happens for modules in private repos. To solve this, I used GOPRIVATE="github.com/YourOrganizationName" go get .... You can also change the default setting using:

go env -w GOPRIVATE="github.com/YourOrganizationName"

@guiguan what was the exact error you were seeing before you made that configuration change with GOPRIVATE?

@thepudds yes, that 410 Gone error

I am closing the issue because of no new bug reports (except @joeblubaugh but waiting for details) for the v1.18.0 release.

@jirfag I'm still having issues on Go 1.13 using the 1.18.0 release. As shown below:

  • I'm having the GOPRIVATE env variable set (this is regardless of golangci-lint).
  • When running golang-ci the typecheck checkers fails
Mathieus-MacBook-Pro:newapi mhindery$ go version
go version go1.13 darwin/amd64
Mathieus-MacBook-Pro:newapi mhindery$ printenv | grep GO
GOPRIVATE=*.otainsight.com
Mathieus-MacBook-Pro:newapi mhindery$ go get github.com/golangci/golangci-lint/cmd/[email protected]
Mathieus-MacBook-Pro:newapi mhindery$ golangci-lint run --deadline=1m --disable-all -E deadcode,gosimple,govet,ineffassign,varcheck,unconvert,prealloc,unparam,typecheck
pkg/otabrands/otabrands.go:1: /usr/local/Cellar/go/1.13/libexec/src/encoding/json/fold.go:83:20: DecodeRune not declared by package utf8 (typecheck)
package otabrands
pkg/protos/benchmark.pb.go:1: /usr/local/Cellar/go/1.13/libexec/src/fmt/scan.go:1200:16: DecodeRuneInString not declared by package utf8 (typecheck)
// Code generated by protoc-gen-go. DO NOT EDIT.
pkg/utils/date/models.go:1: /usr/local/Cellar/go/1.13/libexec/src/strconv/quote.go:405:12: ValidString not declared by package utf8 (typecheck)
package date
pkg/monitoring/monitoring.go:1: /usr/local/Cellar/go/1.13/libexec/src/fmt/scan.go:1200:16: DecodeRuneInString not declared by package utf8 (typecheck)
package monitoring
pkg/utils/mysql/client.go:1: /usr/local/Cellar/go/1.13/libexec/src/regexp/regexp.go:967:22: DecodeRuneInString not declared by package utf8 (typecheck)
package mysql
pkg/utils/bigtable/client.go:1: /usr/local/Cellar/go/1.13/libexec/src/strings/strings.go:980:20: DecodeRuneInString not declared by package utf8 (typecheck)
package bigtable
pkg/utils/caching/inmemclient.go:1: /usr/local/Cellar/go/1.13/libexec/src/encoding/gob/type.go:558:18: DecodeRuneInString not declared by package utf8 (typecheck)
package caching
pkg/webapi/models/input.go:1: /usr/local/Cellar/go/1.13/libexec/src/strconv/quote.go:405:12: ValidString not declared by package utf8 (typecheck)
package models
pkg/api/controllers/base.go:1: /Users/mhindery/go/pkg/mod/github.com/golang/[email protected]/proto/text_parser.go:255:15: DecodeRuneInString not declared by package utf8 (typecheck)
package controllers
...  # ommited similar lines
Mathieus-MacBook-Pro:newapi mhindery$

@mhindery got it, create a separate issue for the GOPRIVATE problem, please. And does it work ok without GOPRIVATE?

Turns out my issue had nothing to do with GOPRIVATE or not, but I had an install via brew of v1.17.1 which took precedence over the v1.18.0 version obtained from go get when invoking the golangci-lint command. The latest version works without problem.

c3a532e

How did you generate go.sum? Thanks!

@JingleCEF There were a few known issues with Go 1.13 with previous releases. Try upgrading your go.mod file to the latest v1.19.1 release to see if that resolves your issue.

@JingleCEF There were a few known issues with Go 1.13 with previous releases. Try upgrading your go.mod file to the latest v1.19.1 release to see if that resolves

What's v1.18 and 1.19 you guys talked about? I can only see the latest version is go 1.13 (1.13.1).

@JingleCEF Sorry there are two versions at play. The first is the Go version in this case Go 1.13. The other is the golangci-lint version which is v1.19.1 and is listed in the project releases. When using Go 1.11 or newer you can pin your project to a specific release of any dependency when using Go modules by adding it to your go.mod file. Please refer to the official Go documentation on how to do this.

@JingleCEF Sorry there are two versions at play. The first is the Go version in this case Go 1.13. The other is the golangci-lint version which is v1.19.1 and is listed in the project releases. When using Go 1.11 or newer you can pin your project to a specific release of any dependency when using Go modules by adding it to your go.mod file. Please refer to the official Go documentation on how to do this.

It looks my problem is because the library version in go.mod and go.sum are too old. After updating with latest versions, it passed build. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alessio picture alessio  路  4Comments

ferhatelmas picture ferhatelmas  路  4Comments

simonpasquier picture simonpasquier  路  4Comments

anuaimi picture anuaimi  路  4Comments

jsm picture jsm  路  5Comments