Forráskód Böngészése

Windows: work around Go 1.6.2/Nano Server TP5 issue

This works around golang/go#15286 by explicitly loading shell32.dll at
load time, ensuring that syscall can load it dynamically during process
startup.

Signed-off-by: John Starks <jostarks@microsoft.com>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
John Starks 9 éve
szülő
commit
fa82c0aa10
4 módosított fájl, 27 hozzáadás és 8 törlés
  1. 13 0
      cmd/docker/docker_windows.go
  2. 13 0
      cmd/dockerd/docker_windows.go
  3. 1 1
      hack/make.sh
  4. 0 7
      hack/make/cross

+ 13 - 0
cmd/docker/docker_windows.go

@@ -1,5 +1,18 @@
 package main
 
 import (
+	"sync/atomic"
+
 	_ "github.com/docker/docker/autogen/winresources/docker"
 )
+
+//go:cgo_import_dynamic main.dummy CommandLineToArgvW%2 "shell32.dll"
+
+var dummy uintptr
+
+func init() {
+	// Ensure that this import is not removed by the linker. This is used to
+	// ensure that shell32.dll is loaded by the system loader, preventing
+	// go#15286 from triggering on Nano Server TP5.
+	atomic.LoadUintptr(&dummy)
+}

+ 13 - 0
cmd/dockerd/docker_windows.go

@@ -1,5 +1,18 @@
 package main
 
 import (
+	"sync/atomic"
+
 	_ "github.com/docker/docker/autogen/winresources/dockerd"
 )
+
+//go:cgo_import_dynamic main.dummy CommandLineToArgvW%2 "shell32.dll"
+
+var dummy uintptr
+
+func init() {
+	// Ensure that this import is not removed by the linker. This is used to
+	// ensure that shell32.dll is loaded by the system loader, preventing
+	// go#15286 from triggering on Nano Server TP5.
+	atomic.LoadUintptr(&dummy)
+}

+ 1 - 1
hack/make.sh

@@ -117,7 +117,7 @@ if [ "$AUTO_GOPATH" ]; then
 	if [ "$(go env GOOS)" = 'solaris' ]; then
 		# sys/unix is installed outside the standard library on solaris
 		# TODO need to allow for version change, need to get version from go
-		export GOPATH="${GOPATH}:/usr/lib/gocode/1.5"
+		export GOPATH="${GOPATH}:/usr/lib/gocode/1.6.2"
 	fi
 fi
 

+ 0 - 7
hack/make/cross

@@ -27,13 +27,6 @@ for platform in $DOCKER_CROSSPLATFORMS; do
 		export GOOS=${platform%/*}
 		export GOARCH=${platform##*/}
 
-		# !!! TEMPORARY HACK !!!
-		# See Dockerfile
-		if [ "$platform" == "windows/amd64" ]; then
-			export GOROOT="/usr/local/go${HACK_GO_VERSION}"
-			export PATH=$(echo "$PATH" | sed "s,:/usr/local/go/bin:,:/usr/local/go${HACK_GO_VERSION}/bin:,")
-		fi
-
 		if [ -z "${daemonSupporting[$platform]}" ]; then
             # we just need a simple client for these platforms
 			export LDFLAGS_STATIC_DOCKER=""