remove depricated methods from go sdk examples (#8689)

* remove depricated methods from go sdk examples

* use negotiate client option; handle import & tty review comment
This commit is contained in:
Alex Goodman 2019-07-23 11:56:00 -04:00 committed by Adrian Plata
parent a8284a1daf
commit 07360ef578
1 changed files with 13 additions and 11 deletions

View File

@ -40,18 +40,18 @@ command prompt:
package main
import (
"io"
"os"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)
func main() {
ctx := context.Background()
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -89,7 +89,7 @@ func main() {
panic(err)
}
io.Copy(os.Stdout, out)
stdcopy.StdCopy(os.Stdout, os.Stderr, out)
}
```
@ -156,7 +156,7 @@ import (
func main() {
ctx := context.Background()
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -238,7 +238,8 @@ import (
)
func main() {
cli, err := client.NewEnvClient()
ctx := context.Background()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -314,7 +315,7 @@ import (
func main() {
ctx := context.Background()
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -395,7 +396,7 @@ import (
func main() {
ctx := context.Background()
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -463,7 +464,8 @@ import (
)
func main() {
cli, err := client.NewEnvClient()
ctx := context.Background()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -534,7 +536,7 @@ import (
func main() {
ctx := context.Background()
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -610,7 +612,7 @@ import (
func main() {
ctx := context.Background()
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
@ -707,7 +709,7 @@ import (
func main() {
ctx := context.Background()
cli, err := client.NewEnvClient()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}