Open mikemadden42 opened 5 years ago
I get a feeling this is related to #147 . Still working on reproducing.
If it helps, I'm getting the same error on Linux:
$ pwd
/home/pcfens
$ echo $GOPATH
/home/pcfens/git/go
$ go version
go version go1.12.4 linux/amd64
$ rm -Rf $GOPATH/*
zsh: sure you want to delete all the files in /home/pcfens/git/go [yn]? y
$ go get github.com/wagoodman/dive
# github.com/wagoodman/dive/image
git/go/src/github.com/wagoodman/dive/image/docker_image.go:92:46: cannot use clientOpts (type []func(*client.Client) error) as type []client.Opt in argument to client.NewClientWithOpts
Got hit by this also. Tried several versions of go with the same result.
Thanks. I'm still seeing this issue with building dive
.
~: go get -u -ldflags "-s -w" github.com/wagoodman/dive
# github.com/wagoodman/dive/image
go/src/github.com/wagoodman/dive/image/docker_image.go:92:46: cannot use clientOpts (type []func(*client.Client) error) as type []client.Opt in argument to client.NewClientWithOpts
~: go version
go version go1.12.5 darwin/amd64
As others have indicated, this is also an issue on Linux.
# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
# go version
go version go1.12.6 linux/amd64
# go get github.com/wagoodman/dive
# github.com/wagoodman/dive/image
go/src/github.com/wagoodman/dive/image/docker_image.go:92:46: cannot use clientOpts (type []func(*client.Client) error) as type []client.Opt in argument to client.NewClientWithOpts
Also broken for me:
└──╼ go get github.com/wagoodman/dive
# github.com/wagoodman/dive/image
../../../../gocode/src/github.com/wagoodman/dive/image/docker_image.go:92:46: cannot use clientOpts (type []func(*client.Client) error) as type []client.Opt in argument to client.NewClientWithOpts
Same deal on Windows: ( go newly installed with choco install golang
)
PS C:\WINDOWS\system32> go version
go version go1.12.9 windows/amd64
PS C:\WINDOWS\system32> go get github.com/wagoodman/dive
# github.com/wagoodman/dive/image
C:\Users\user\go\src\github.com\wagoodman\dive\image\docker_image.go:97:46: cannot use clientOpts (type []func(*client.Client) error) as type []client.Opt in argument to client.NewClientWithOpts
I don't know go much at all, but it looks like the docker dependency pinned in go.mod did not work for github.com/docker/docker.
When i check the downloaded version in go/src/github.com/docker/docker , it points to trunk. I nuked the entire go/src/github.com directory and retried and got the same result.
EDIT: I tried to run it from within Jetbrains GoLand and it seems to compile fine there, but i can clearly see the compilation process switches to correct package versions, with output like:
go: finding github.com/docker/docker v0.0.0-20181126153310-0b7cb16dde4a20d024c7be59801d63bcfd18611b
go: downloading github.com/docker/docker v0.0.0-20181126153310-0b7cb16dde4a20d024c7be59801d63bcfd18611b
go: extracting github.com/docker/docker v0.0.0-20181126153310-0b7cb16dde4a20d024c7be59801d63bcfd18611b
Whereas with trying go get -v
from shell it doesnt seem to switch anything at all:
PS C:\WINDOWS\system32> go get -v github.com/wagoodman/dive
github.com/wagoodman/dive (download)
github.com/mitchellh/go-homedir (download)
github.com/sirupsen/logrus (download)
github.com/konsorten/go-windows-terminal-sequences (download)
github.com/spf13/cobra (download)
github.com/inconshreveable/mousetrap (download)
github.com/spf13/pflag (download)
github.com/spf13/viper (download)
github.com/fsnotify/fsnotify (download)
github.com/hashicorp/hcl (download)
github.com/magiconair/properties (download)
github.com/mitchellh/mapstructure (download)
github.com/pelletier/go-toml (download)
github.com/spf13/afero (download)
Fetching https://golang.org/x/text/transform?go-get=1
Parsing meta tags from https://golang.org/x/text/transform?go-get=1 (status code 200)
get "golang.org/x/text/transform": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/transform?go-get=1
get "golang.org/x/text/transform": verifying non-authoritative meta tag
Fetching https://golang.org/x/text?go-get=1
Parsing meta tags from https://golang.org/x/text?go-get=1 (status code 200)
golang.org/x/text (download)
Fetching https://golang.org/x/text/unicode/norm?go-get=1
Parsing meta tags from https://golang.org/x/text/unicode/norm?go-get=1 (status code 200)
get "golang.org/x/text/unicode/norm": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/norm?go-get=1
get "golang.org/x/text/unicode/norm": verifying non-authoritative meta tag
github.com/spf13/cast (download)
github.com/spf13/jwalterweatherman (download)
github.com/subosito/gotenv (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
github.com/cespare/xxhash (download)
github.com/dustin/go-humanize (download)
github.com/fatih/color (download)
github.com/google/uuid (download)
github.com/phayes/permbits (download)
github.com/logrusorgru/aurora (download)
github.com/docker/cli (download)
github.com/docker/docker (download)
github.com/jroimartin/gocui (download)
github.com/nsf/termbox-go (download)
github.com/mattn/go-runewidth (download)
Fetching https://golang.org/x/net/context?go-get=1
Parsing meta tags from https://golang.org/x/net/context?go-get=1 (status code 200)
get "golang.org/x/net/context": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/context?go-get=1
get "golang.org/x/net/context": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
github.com/lunixbochs/vtclean (download)
github.com/wagoodman/keybinding (download)
github.com/wagoodman/dive/image
# github.com/wagoodman/dive/image
C:\Users\user\go\src\github.com\wagoodman\dive\image\docker_image.go:97:46: cannot use clientOpts (type []func(*client.Client) error) as type []client.Opt in argument to client.NewClientWithOpts
Ok figured it out: my go thinks it is in legacy GOPATH mode, as hinted by
PS C:\WINDOWS\system32> go get github.com/wagoodman/dive@v0.8.1
go: cannot use path@version syntax in GOPATH mode
Forcing env var GO111MODULE="on" makes it come to it's senses, but deleting GOPATH env var did not.
PS C:\WINDOWS\system32> $env:GO111MODULE="on"
PS C:\WINDOWS\system32> go get -v github.com/wagoodman/dive@v0.8.1
go: finding github.com/wagoodman/dive v0.8.1
...
github.com/wagoodman/dive/cmd
github.com/wagoodman/dive
PS C:\WINDOWS\system32>
Success !
@kaidokert findings seem correct. On my Ubuntu system, go version 1.10.4 got the most recent code (from master branch) from github.com/docker/docker. Forcing it to go to an earlier version makes the code compile:
$ go get github.com/wagoodman/dive
# github.com/wagoodman/dive/image
go/src/github.com/wagoodman/dive/image/docker_image.go:97:46: cannot use clientOpts (type []func(*client.Client) error) as type []client.Opt in argument to client.NewClientWithOpts
$ fgrep docker/docker ~/go/src/github.com/wagoodman/dive/go.mod
github.com/docker/docker v0.0.0-20181126153310-0b7cb16dde4a20d024c7be59801d63bcfd18611b
replace github.com/docker/docker => github.com/docker/docker v1.4.2-0.20181124105010-0b7cb16dde4a
$ cd ~/go/src/github.com/docker/docker
$ git status
On branch master
Your branch is up to date with 'origin/master'.
$ git checkout 0b7cb16dde4a20d024c7be59801d63bcfd18611b
Note: checking out '0b7cb16dde4a20d024c7be59801d63bcfd18611b'.
You are in 'detached HEAD' state. …
$ go get github.com/wagoodman/dive
$ dive deadbeef1234
(it works!)
And I believe the following commit broke dive
: https://github.com/moby/moby/commit/e6c0d19c3a5ebd0d719bb21c29b9d2395c7c3719
I even tried changing this line: https://github.com/wagoodman/dive/blob/65f87b00a947a20dc62f57cfef1c59009ba2fec2/image/docker_image.go#L68
- var clientOpts []func(*client.Client) error
+ var clientOpts []client.Opt
That one line change is enough to make dive
compile with the latest (master
) docker/docker/client. However, that change is not enough, because the compiled binary fails to find the docker image I passed by the parameter (while the unchanged dive
code with the older docker/docker/client works fine). Thus some further debugging is needed, but I won't do that. If you are reading this, please, feel free to continue debugging and fixing from this point on. ;)
I'm unable to build dive on macOS: