Skip to content

Commit fa82c0a

Browse files
jstarksruncom
authored andcommitted
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 <[email protected]> Signed-off-by: Antonio Murdaca <[email protected]>
1 parent f32ccb0 commit fa82c0a

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

cmd/docker/docker_windows.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
package main
22

33
import (
4+
"sync/atomic"
5+
46
_ "github.com/docker/docker/autogen/winresources/docker"
57
)
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+
}

cmd/dockerd/docker_windows.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
package main
22

33
import (
4+
"sync/atomic"
5+
46
_ "github.com/docker/docker/autogen/winresources/dockerd"
57
)
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+
}

hack/make.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ if [ "$AUTO_GOPATH" ]; then
117117
if [ "$(go env GOOS)" = 'solaris' ]; then
118118
# sys/unix is installed outside the standard library on solaris
119119
# 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"
121121
fi
122122
fi
123123

hack/make/cross

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ for platform in $DOCKER_CROSSPLATFORMS; do
2727
export GOOS=${platform%/*}
2828
export GOARCH=${platform##*/}
2929

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-
3730
if [ -z "${daemonSupporting[$platform]}" ]; then
3831
# we just need a simple client for these platforms
3932
export LDFLAGS_STATIC_DOCKER=""

0 commit comments

Comments
 (0)