Skip to content

Commit bbd22fb

Browse files
Vikram bir SinghthaJeztah
authored andcommitted
Move GOPATH out from under the GO source tree
Unlike Linux which uses a temp dir as GOPATH, Windows uses c:\go. Among other things, this blocks go get. Moving GOPATH to c:\gopath and updating references in comments and documentation. Currently the change is being scoped narrowly. In the future GOPATH value could be passed as a parameter to the ps1 scripts. Signed-off-by: Vikram bir Singh <vikrambir.singh@docker.com> (cherry picked from commit ecf91f0) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 9077436 commit bbd22fb

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Dockerfile.windows

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
#
4646
# 1. Clone the sources from github.com:
4747
#
48-
# >> git clone https://github.com/docker/docker.git C:\go\src\github.com\docker\docker
49-
# >> Cloning into 'C:\go\src\github.com\docker\docker'...
48+
# >> git clone https://github.com/docker/docker.git C:\gopath\src\github.com\docker\docker
49+
# >> Cloning into 'C:\gopath\src\github.com\docker\docker'...
5050
# >> remote: Counting objects: 186216, done.
5151
# >> remote: Compressing objects: 100% (21/21), done.
5252
# >> remote: Total 186216 (delta 5), reused 0 (delta 0), pack-reused 186195
@@ -59,7 +59,7 @@
5959
#
6060
# 2. Change directory to the cloned docker sources:
6161
#
62-
# >> cd C:\go\src\github.com\docker\docker
62+
# >> cd C:\gopath\src\github.com\docker\docker
6363
#
6464
#
6565
# 3. Build a docker image with the components required to build the docker binaries from source
@@ -79,8 +79,8 @@
7979
# 5. Copy the binaries out of the container, replacing HostPath with an appropriate destination
8080
# folder on the host system where you want the binaries to be located.
8181
#
82-
# >> docker cp binaries:C:\go\src\github.com\docker\docker\bundles\docker.exe C:\HostPath\docker.exe
83-
# >> docker cp binaries:C:\go\src\github.com\docker\docker\bundles\dockerd.exe C:\HostPath\dockerd.exe
82+
# >> docker cp binaries:C:\gopath\src\github.com\docker\docker\bundles\docker.exe C:\HostPath\docker.exe
83+
# >> docker cp binaries:C:\gopath\src\github.com\docker\docker\bundles\dockerd.exe C:\HostPath\dockerd.exe
8484
#
8585
#
8686
# 6. (Optional) Remove the interim container holding the built executable binaries:
@@ -172,7 +172,7 @@ ARG GO_VERSION=1.12.14
172172
# - FROM_DOCKERFILE is used for detection of building within a container.
173173
ENV GO_VERSION=${GO_VERSION} `
174174
GIT_VERSION=2.11.1 `
175-
GOPATH=C:\go `
175+
GOPATH=C:\gopath `
176176
FROM_DOCKERFILE=1
177177

178178
RUN `
@@ -249,7 +249,7 @@ RUN `
249249
Remove-Item C:\gitsetup.zip; `
250250
`
251251
Write-Host INFO: Creating source directory...; `
252-
New-Item -ItemType Directory -Path C:\go\src\github.com\docker\docker | Out-Null; `
252+
New-Item -ItemType Directory -Path ${GOPATH}\src\github.com\docker\docker | Out-Null; `
253253
`
254254
Write-Host INFO: Configuring git core.autocrlf...; `
255255
C:\git\cmd\git config --global core.autocrlf true; `
@@ -260,7 +260,7 @@ RUN `
260260
ENTRYPOINT ["powershell.exe"]
261261

262262
# Set the working directory to the location of the sources
263-
WORKDIR C:\go\src\github.com\docker\docker
263+
WORKDIR ${GOPATH}\src\github.com\docker\docker
264264

265265
# Copy the sources into the container
266266
COPY . .

docs/contributing/software-req-win.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ To build Moby, run:
100100
Copy out the resulting Windows Moby Engine binary to `dockerd.exe` in the
101101
current directory:
102102

103-
docker cp binaries:C:\go\src\github.com\docker\docker\bundles\docker.exe docker.exe
104-
docker cp binaries:C:\go\src\github.com\docker\docker\bundles\dockerd.exe dockerd.exe
103+
docker cp binaries:C:\gopath\src\github.com\docker\docker\bundles\docker.exe docker.exe
104+
docker cp binaries:C:\gopath\src\github.com\docker\docker\bundles\dockerd.exe dockerd.exe
105105

106106
To test it, stop the system Docker daemon and start the one you just built:
107107

108108
Stop-Service Docker
109109
.\dockerd.exe -D
110110

111111
The other make targets work too, to run unit tests try:
112-
`docker run --rm docker-builder sh -c 'cd /c/go/src/github.com/docker/docker; hack/make.sh test-unit'`.
112+
`docker run --rm docker-builder sh -c 'cd /c/gopath/src/github.com/docker/docker; hack/make.sh test-unit'`.
113113

114114
### 6. Remove the interim binaries container
115115

hack/ci/windows.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ Try {
486486
}
487487

488488
# Following at the moment must be docker\docker as it's dictated by dockerfile.Windows
489-
$contPath="$COMMITHASH`:c`:\go\src\github.com\docker\docker\bundles"
489+
$contPath="$COMMITHASH`:c`:\gopath\src\github.com\docker\docker\bundles"
490490

491491
# After https://github.com/docker/docker/pull/30290, .git was added to .dockerignore. Therefore
492492
# we have to calculate unsupported outside of the container, and pass the commit ID in through
@@ -850,7 +850,7 @@ Try {
850850
$Duration= $(Measure-Command { & docker run `
851851
--rm `
852852
-e c=$c `
853-
--workdir "c`:\go\src\github.com\docker\docker\integration-cli" `
853+
--workdir "c`:\gopath\src\github.com\docker\docker\integration-cli" `
854854
-v "$env:TEMP\binary`:c:\target" `
855855
docker `
856856
"`$env`:PATH`='c`:\target;'+`$env:PATH`; `$env:DOCKER_HOST`='tcp`://'+(ipconfig | select -last 1).Substring(39)+'`:2357'; c:\target\runIntegrationCLI.ps1" | Out-Host } )

0 commit comments

Comments
 (0)