Docker Community Forums

Share and learn in the Docker community.

Possible doc bug for go client

docker

(Rob Kielty) #1

Hi,

In develop/sdk/index.md we have the following instruction under the heading Go SDK :

go get github.com/docker/docker/client

But when I run this from the command line I get the following errors

$ go get github.com/docker/docker/client
# github.com/docker/docker/client
src/github.com/docker/docker/client/client.go:101: undefined: http.ErrUseLastResponse
src/github.com/docker/docker/client/client.go:179: transport.DialContext undefined (type *http.Transport has no field or method DialContext)
src/github.com/docker/docker/client/client.go:179: dialer.DialContext undefined (type *net.Dialer has no field or method DialContext)
src/github.com/docker/docker/client/hijack.go:73: undefined: "time".Until
src/github.com/docker/docker/client/hijack.go:117: undefined: tlsConfigClone

Is this instruction correct in the docs or are these errors I see local to my setup?

Local setup

~/dev/orc$ go version
go version go1.6.2 linux/amd64

~/dev/orc$ docker --version
Docker version 17.12.1-ce, build 7390fc6

~/dev/orc$ echo $GOPATH 
/home/rkielty/dev/orc

$ uname -a
Linux my-machine-name 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

In the unlikely event that this is a doc bug am happy to submit a fix based on any info gathered here.

MT for any help provided :slight_smile:
Rob


(David Maze) #2

In Go time, that’s…really really old. (Even if it’s only 2 years old in calendar time.)

I don’t see a minimum Go version called out in any documentation I can easily find. Go 1.7’s big feature was adding "context", and transport.DialContext and dialer.DialContext almost certainly came along with that; http.ErrUseLastResponse is also a Go 1.7 feature; time.Until got added in Go 1.8. So it looks like Go 1.8 is the minimum.

In my experience Go has been pretty serious about their backwards compatibility guarantees and upgrading the Go toolchain version is pretty safe. For practical development you almost certainly want context in the standard library anyways and I’d encourage upgrading.


(Rob Kielty) #3

Cheers David, I’ll upgrade and report back.
Rob


(Rob Kielty) #4

I logged the following PR https://github.com/docker/docker.github.io/pull/6155