From 237a4a71da38e117c7d0fbfb22b0c01f5866b32a Mon Sep 17 00:00:00 2001 From: 3846masa <3846masahiro+git@gmail.com> Date: Thu, 7 Sep 2017 19:11:19 +0900 Subject: [PATCH] Fix build for Windows --- appveyor.yml | 6 ++++-- client/client.go | 10 +++------- script/build | 4 ++-- script/build-for-windows.ps1 | 6 ++++++ 4 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 script/build-for-windows.ps1 diff --git a/appveyor.yml b/appveyor.yml index 5f917931..43d2ea96 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,12 +19,14 @@ install: build_script: - golint ./... - go test ./... - - script/build + - ps: script/build-for-windows.ps1 test: off deploy: provider: GitHub - GitHub: "build/whalebrew-Windows-x86_64.exe" + auth_token: + secure: "" + artifact: "build/whalebrew-Windows-x86_64.exe" on: appveyor_repo_tag: true diff --git a/client/client.go b/client/client.go index 85be6f34..301ea7f2 100644 --- a/client/client.go +++ b/client/client.go @@ -1,21 +1,17 @@ package client import ( - "github.com/docker/docker/api/types" + "context" + "github.com/docker/docker/client" ) -// DefaultVersion is the Engine API version used by Whalebrew -const DefaultVersion string = "1.20" - // NewClient returns a Docker client configured for Whalebrew func NewClient() (*client.Client, error) { cli, err := client.NewEnvClient() if err != nil { return cli, err } - cli.NegotiateAPIVersionPing(types.Ping{ - APIVersion: DefaultVersion, - }) + cli.NegotiateAPIVersion(context.Background()) return cli, nil } diff --git a/script/build b/script/build index 506cec3a..8498d0cc 100755 --- a/script/build +++ b/script/build @@ -4,8 +4,8 @@ set -e mkdir -p build cd build -gox -osarch="linux/amd64" -osarch="darwin/amd64" --osarch="windows/amd64" ../ + +gox -osarch="linux/amd64" -osarch="darwin/amd64" ../ mv whalebrew_linux_amd64 whalebrew-Linux-x86_64 mv whalebrew_darwin_amd64 whalebrew-Darwin-x86_64 -mv whalebrew_windows_amd64.exe whalebrew-Windows-x86_64.exe diff --git a/script/build-for-windows.ps1 b/script/build-for-windows.ps1 new file mode 100644 index 00000000..34be0bc4 --- /dev/null +++ b/script/build-for-windows.ps1 @@ -0,0 +1,6 @@ +New-Item -ItemType Directory -Path ./build +Set-Location ./build + +gox -osarch="windows/amd64" ../ + +Move-Item whalebrew_windows_amd64.exe whalebrew-Windows-x86_64.exe