Browse code

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 authored on 2016/05/21 02:38:31
Showing 4 changed files
... ...
@@ -1,5 +1,18 @@
1 1
 package main
2 2
 
3 3
 import (
4
+	"sync/atomic"
5
+
4 6
 	_ "github.com/docker/docker/autogen/winresources/docker"
5 7
 )
8
+
9
+//go:cgo_import_dynamic main.dummy CommandLineToArgvW%2 "shell32.dll"
10
+
11
+var dummy uintptr
12
+
13
+func init() {
14
+	// Ensure that this import is not removed by the linker. This is used to
15
+	// ensure that shell32.dll is loaded by the system loader, preventing
16
+	// go#15286 from triggering on Nano Server TP5.
17
+	atomic.LoadUintptr(&dummy)
18
+}
... ...
@@ -1,5 +1,18 @@
1 1
 package main
2 2
 
3 3
 import (
4
+	"sync/atomic"
5
+
4 6
 	_ "github.com/docker/docker/autogen/winresources/dockerd"
5 7
 )
8
+
9
+//go:cgo_import_dynamic main.dummy CommandLineToArgvW%2 "shell32.dll"
10
+
11
+var dummy uintptr
12
+
13
+func init() {
14
+	// Ensure that this import is not removed by the linker. This is used to
15
+	// ensure that shell32.dll is loaded by the system loader, preventing
16
+	// go#15286 from triggering on Nano Server TP5.
17
+	atomic.LoadUintptr(&dummy)
18
+}
... ...
@@ -117,7 +117,7 @@ if [ "$AUTO_GOPATH" ]; then
117 117
 	if [ "$(go env GOOS)" = 'solaris' ]; then
118 118
 		# sys/unix is installed outside the standard library on solaris
119 119
 		# TODO need to allow for version change, need to get version from go
120
-		export GOPATH="${GOPATH}:/usr/lib/gocode/1.5"
120
+		export GOPATH="${GOPATH}:/usr/lib/gocode/1.6.2"
121 121
 	fi
122 122
 fi
123 123
 
... ...
@@ -27,13 +27,6 @@ for platform in $DOCKER_CROSSPLATFORMS; do
27 27
 		export GOOS=${platform%/*}
28 28
 		export GOARCH=${platform##*/}
29 29
 
30
-		# !!! TEMPORARY HACK !!!
31
-		# See Dockerfile
32
-		if [ "$platform" == "windows/amd64" ]; then
33
-			export GOROOT="/usr/local/go${HACK_GO_VERSION}"
34
-			export PATH=$(echo "$PATH" | sed "s,:/usr/local/go/bin:,:/usr/local/go${HACK_GO_VERSION}/bin:,")
35
-		fi
36
-
37 30
 		if [ -z "${daemonSupporting[$platform]}" ]; then
38 31
             # we just need a simple client for these platforms
39 32
 			export LDFLAGS_STATIC_DOCKER=""