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

Cannot install - gomodguard fails #1087

Closed
2 tasks done
dmlyons opened this issue May 13, 2020 · 10 comments
Closed
2 tasks done

Cannot install - gomodguard fails #1087

dmlyons opened this issue May 13, 2020 · 10 comments
Labels
area: install Issue relates to installation or downloading process bug Something isn't working

Comments

@dmlyons
Copy link

dmlyons commented May 13, 2020

Thank you for creating the issue!

  • [ x] 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 v1.26.0 built from (unknown, mod sum: "h1:CLLGRSA9BLMiNvsWPXHioYAdfIx9tkgdVWyA6bIdYCo=") on (unknown)
Config file
$ cat .golangci.yml
no config file
Go environment
$ go version && go env
09:43 $ go version && go env
go version go1.14.2 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/dl/.cache/go-build"
GOENV="/home/dl/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/dl/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/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-build381143871=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
09:43 $ GO111MODULE=on go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
go: found github.com/golangci/golangci-lint/cmd/golangci-lint in github.com/golangci/golangci-lint v1.26.0
go: golang.org/x/tools upgrade => v0.0.0-20200513122804-866d71a3170a
go: github.com/mattn/go-colorable upgrade => v0.1.6
go: github.com/gostaticanalysis/analysisutil upgrade => v0.0.3
go: github.com/jirfag/go-printf-func-name upgrade => v0.0.0-20200119135958-7558a9eaa5af
go: github.com/golangci/gocyclo upgrade => v0.0.0-20180528144436-0a533e8fa43d
go: github.com/spf13/jwalterweatherman upgrade => v1.1.0
go: github.com/pkg/errors upgrade => v0.9.1
go: github.com/mattn/go-isatty upgrade => v0.0.12
go: github.com/bombsimon/wsl/v3 upgrade => v3.1.0
go: github.com/fsnotify/fsnotify upgrade => v1.4.9
go: github.com/stretchr/objx upgrade => v0.2.0
go: github.com/sirupsen/logrus upgrade => v1.6.0
go: honnef.co/go/tools upgrade => v0.0.1-2020.1.3
go: golang.org/x/sys upgrade => v0.0.0-20200513112337-417ce2331b5c
go: github.com/golangci/revgrep upgrade => v0.0.0-20180812185044-276a5c0a1039
go: github.com/gogo/protobuf upgrade => v1.3.1
go: gopkg.in/yaml.v2 upgrade => v2.3.0
go: github.com/stretchr/testify upgrade => v1.5.1
go: github.com/go-toolsmith/astp upgrade => v1.0.0
go: github.com/ryancurrah/gomodguard upgrade => v1.1.0
go: github.com/konsorten/go-windows-terminal-sequences upgrade => v1.0.3
go: github.com/go-critic/go-critic upgrade => v0.4.3
go: gopkg.in/ini.v1 upgrade => v1.56.0
go: golang.org/x/text upgrade => v0.3.2
go: github.com/securego/gosec upgrade => v0.0.0-20200401082031-e946c8c39989
go: github.com/Djarvur/go-err113 upgrade => v0.0.0-20200511133814-5174e21577d5
go: github.com/spf13/cast upgrade => v1.3.1
go: github.com/sourcegraph/go-diff upgrade => v0.5.2
go: github.com/tdakkota/asciicheck upgrade => v0.0.0-20200416200610-e657995f937b
go: sourcegraph.com/sqs/pbtypes upgrade => v1.0.0
go: github.com/fatih/color upgrade => v1.9.0
go: github.com/tetafro/godot upgrade => v0.3.8
go: golang.org/x/xerrors upgrade => v0.0.0-20191204190536-9bdfabe68543
go: github.com/go-toolsmith/astfmt upgrade => v1.0.0
go: mvdan.cc/unparam upgrade => v0.0.0-20200501210554-b37ab49443f7
go: golang.org/x/mod upgrade => v0.2.0
go: github.com/spf13/afero upgrade => v1.2.2
go: github.com/spf13/cobra upgrade => v1.0.0
go: github.com/timakin/bodyclose upgrade => v0.0.0-20200424151742-cb6215831a94
go: github.com/magiconair/properties upgrade => v1.8.1
go: github.com/spf13/pflag upgrade => v1.0.5
go: github.com/spf13/viper upgrade => v1.7.0
go: github.com/davecgh/go-spew upgrade => v1.1.1
go: github.com/pelletier/go-toml upgrade => v1.7.0
go: github.com/go-toolsmith/astequal upgrade => v1.0.0
go: github.com/mitchellh/mapstructure upgrade => v1.3.0
go: github.com/mitchellh/go-homedir upgrade => v1.1.0
# github.com/golangci/golangci-lint/pkg/golinters
/home/dl/go/pkg/mod/github.com/golangci/golangci-lint@v1.26.0/pkg/golinters/gomodguard.go:47:36: unknown field 'k' in struct literal of type gomodguard.BlockedModule
/home/dl/go/pkg/mod/github.com/golangci/golangci-lint@v1.26.0/pkg/golinters/gomodguard.go:51:43: cannot use m (type gomodguard.BlockedModule) as type map[string]gomodguard.BlockedModule in append
@dmlyons dmlyons added the bug Something isn't working label May 13, 2020
@dmlyons
Copy link
Author

dmlyons commented May 13, 2020

Same result if I specify v1.26.0

@dmlyons
Copy link
Author

dmlyons commented May 13, 2020

it is the -u that is breaking it, from https://github.com/golang/go/wiki/Modules:

go get -u (without any arguments) now only upgrades the direct and indirect dependencies of your current package, and no longer examines your entire module.

it is upgrading gomodguard to a version that does not work

@dmlyons
Copy link
Author

dmlyons commented May 13, 2020

Workaround for now, remove the -u and specify a version:

GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0

@manute
Copy link

manute commented May 13, 2020

Same here.
To me the workaround was to pin the version to 1.24, because with 1.26 and 1.25 it produced the same errors.

> go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0
go: found github.com/golangci/golangci-lint/cmd/golangci-lint in github.com/golangci/golangci-lint v1.26.0
```shell
# github.com/golangci/golangci-lint/pkg/golinters
../../../../../pkg/mod/github.com/golangci/golangci-lint@v1.26.0/pkg/golinters/gomodguard.go:47:36: unknown field 'k' in struct literal of type gomodguard.BlockedModule
../../../../../pkg/mod/github.com/golangci/golangci-lint@v1.26.0/pkg/golinters/gomodguard.go:51:43: cannot use m (type gomodguard.BlockedModule) as type map[string]gomodguard.BlockedModule in append
> go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.25.0
go: found github.com/golangci/golangci-lint/cmd/golangci-lint in github.com/golangci/golangci-lint v1.25.0
# github.com/golangci/golangci-lint/pkg/golinters
../../../../../pkg/mod/github.com/golangci/golangci-lint@v1.25.0/pkg/golinters/gomodguard.go:47:36: unknown field 'k' in struct literal of type gomodguard.BlockedModule
../../../../../pkg/mod/github.com/golangci/golangci-lint@v1.25.0/pkg/golinters/gomodguard.go:51:43: cannot use m (type gomodguard.BlockedModule) as type map[string]gomodguard.BlockedModule in append
> go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0
go: downloading github.com/golangci/golangci-lint v1.24.0
go: found github.com/golangci/golangci-lint/cmd/golangci-lint in github.com/golangci/golangci-lint v1.24.0
go: downloading github.com/bombsimon/wsl/v2 v2.2.0

@ernado
Copy link
Member

ernado commented May 13, 2020

The recommended way of installing via go modules is explicit GO111MODULE=on and version specification.

$ GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0

Other ways are not supported, sorry.
We also can't do anything if your module share some dependencies with golangci-lint and they conflict, please refer to best practices, e.g. using separate tool package.

I've tried this locally:

ernado@nexus:/src$ cd /tmp/
ernado@nexus:/tmp$ mkdir testporject
ernado@nexus:/tmp$ cd testporject/
ernado@nexus:/tmp/testporject$ go mod init module
go: creating new go.mod: module module
ernado@nexus:/tmp/testporject$ GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0
go: finding github.com v1.26.0
go: finding github.com/golangci/golangci-lint/cmd/golangci-lint v1.26.0
go: finding github.com/golangci/golangci-lint/cmd v1.26.0
go: finding github.com/golangci v1.26.0
ernado@nexus:/tmp/testporject$ ls
go.mod  go.sum
ernado@nexus:/tmp/testporject$ ls -lhsa
total 48K
   0 drwxr-xr-x  2 ernado ernado   34 мая 13 18:55 .
4,0K drwxrwxrwt 27 root   root   4,0K мая 13 18:55 ..
4,0K -rw-r--r--  1 ernado ernado   86 мая 13 18:55 go.mod
 40K -rw-r--r--  1 ernado ernado  38K мая 13 18:55 go.sum
ernado@nexus:/tmp/testporject$ golangci-lint --version
golangci-lint has version v1.26.0 built from (unknown, mod sum: "h1:CLLGRSA9BLMiNvsWPXHioYAdfIx9tkgdVWyA6bIdYCo=") on (unknown)

@ernado ernado added the area: install Issue relates to installation or downloading process label May 13, 2020
piyush-garg added a commit to piyush-garg/tektoncd-pipeline-operator that referenced this issue May 15, 2020
This will fix the lint CI failing as some issue
in installing latest golangci-lint

Now it will install the last stable release
I have followed golangci/golangci-lint#1087
to fix this
piyush-garg added a commit to piyush-garg/tektoncd-pipeline-operator that referenced this issue May 15, 2020
This will fix the lint CI failing as some issue
in installing latest golangci-lint

Now it will install the last stable release
I have followed golangci/golangci-lint#1087
to fix this
@ryancurrah
Copy link
Member

I’ve recently refactored gomodguard to support additional block types. So what’s happening here is you are pulling the latest version of gomodguard and golangci is using the correct pinned version. I’ll be making an update to golangci that will resolve this today.

@ryancurrah
Copy link
Member

@dmlyons the next release will fix this issue

@hurrycaner
Copy link

hurrycaner commented May 22, 2020

Still happening on 1.27.0

Output:

$> GO111MODULE=on go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
go: found github.com/golangci/golangci-lint/cmd/golangci-lint in github.com/golangci/golangci-lint v1.27.0
go: github.com/stretchr/objx upgrade => v0.2.0
go: github.com/stretchr/testify upgrade => v1.5.1
go: golang.org/x/text upgrade => v0.3.2
go: golang.org/x/mod upgrade => v0.3.0
go: golang.org/x/tools upgrade => v0.0.0-20200521211927-2b542361a4fc
go: github.com/mattn/go-isatty upgrade => v0.0.12
go: golang.org/x/sys upgrade => v0.0.0-20200519105757-fe76b779f299
go: gopkg.in/yaml.v2 upgrade => v2.3.0
go: honnef.co/go/tools upgrade => v0.0.1-2020.1.4
go: github.com/spf13/cast upgrade => v1.3.1
go: golang.org/x/xerrors upgrade => v0.0.0-20191204190536-9bdfabe68543
go: github.com/Djarvur/go-err113 upgrade => v0.1.0
go: github.com/go-toolsmith/astp upgrade => v1.0.0
go: github.com/mitchellh/mapstructure upgrade => v1.3.1
go: github.com/go-toolsmith/astequal upgrade => v1.0.0
go: github.com/tdakkota/asciicheck upgrade => v0.0.0-20200416200610-e657995f937b
go: github.com/mitchellh/go-homedir upgrade => v1.1.0
go: github.com/golangci/revgrep upgrade => v0.0.0-20180812185044-276a5c0a1039
go: gopkg.in/ini.v1 upgrade => v1.56.0
go: github.com/go-toolsmith/astfmt upgrade => v1.0.0
go: github.com/tetafro/godot upgrade => v0.4.2
go: github.com/spf13/pflag upgrade => v1.0.5
go: github.com/fatih/color upgrade => v1.9.0
go: github.com/pelletier/go-toml upgrade => v1.8.0
go: github.com/bombsimon/wsl/v3 upgrade => v3.1.0
go: github.com/konsorten/go-windows-terminal-sequences upgrade => v1.0.3
go: github.com/spf13/viper upgrade => v1.7.0
go: github.com/sirupsen/logrus upgrade => v1.6.0
go: github.com/gogo/protobuf upgrade => v1.3.1
go: github.com/pkg/errors upgrade => v0.9.1
go: github.com/mattn/go-colorable upgrade => v0.1.6
go: github.com/spf13/jwalterweatherman upgrade => v1.1.0
go: mvdan.cc/unparam upgrade => v0.0.0-20200501210554-b37ab49443f7
go: github.com/davecgh/go-spew upgrade => v1.1.1
go: github.com/go-critic/go-critic upgrade => v0.4.3
go: github.com/ryancurrah/gomodguard upgrade => v1.1.0
go: github.com/gostaticanalysis/analysisutil upgrade => v0.0.3
go: sourcegraph.com/sqs/pbtypes upgrade => v1.0.0
go: github.com/spf13/cobra upgrade => v1.0.0
go: github.com/sourcegraph/go-diff upgrade => v0.5.2
go: github.com/jirfag/go-printf-func-name upgrade => v0.0.0-20200119135958-7558a9eaa5af
go: github.com/golangci/misspell upgrade => v0.3.5
go: github.com/spf13/afero upgrade => v1.2.2
go: github.com/fsnotify/fsnotify upgrade => v1.4.9
go: github.com/BurntSushi/toml upgrade => v0.3.1
go: github.com/Masterminds/semver upgrade => v1.5.0
go: github.com/timakin/bodyclose upgrade => v0.0.0-20200424151742-cb6215831a94
go: github.com/magiconair/properties upgrade => v1.8.1
go: github.com/golangci/gocyclo upgrade => v0.0.0-20180528144436-0a533e8fa43d
# github.com/golangci/golangci-lint/pkg/golinters
../../go/pkg/mod/github.com/golangci/golangci-lint@v1.27.0/pkg/golinters/godot.go:34:17: undefined: godot.Message
../../go/pkg/mod/github.com/golangci/golangci-lint@v1.27.0/pkg/golinters/gomodguard.go:47:36: unknown field 'k' in struct literal of type gomodguard.BlockedModule
../../go/pkg/mod/github.com/golangci/golangci-lint@v1.27.0/pkg/golinters/gomodguard.go:51:43: cannot use m (type gomodguard.BlockedModule) as type map[string]gomodguard.BlockedModule in append

@ernado
Copy link
Member

ernado commented May 22, 2020

@hurrycaner please dont do go get -u

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

@jirfag
Copy link
Member

jirfag commented May 22, 2020

please, use binary installations. go get installations aren't guaranteed to work. Closing as there are at least two ways to fix: binary install, no -u flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: install Issue relates to installation or downloading process bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants