Browse code

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 ecf91f0d7f90b2bd9fa048f2a800beaf613ac507)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Vikram bir Singh authored on 2019/09/10 08:19:03
Showing 3 changed files
... ...
@@ -45,8 +45,8 @@
45 45
 #
46 46
 # 1. Clone the sources from github.com:
47 47
 #
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'...
50 50
 #    >>   remote: Counting objects: 186216, done.
51 51
 #    >>   remote: Compressing objects: 100% (21/21), done.
52 52
 #    >>   remote: Total 186216 (delta 5), reused 0 (delta 0), pack-reused 186195
... ...
@@ -59,7 +59,7 @@
59 59
 #
60 60
 # 2. Change directory to the cloned docker sources:
61 61
 #
62
-#    >>   cd C:\go\src\github.com\docker\docker 
62
+#    >>   cd C:\gopath\src\github.com\docker\docker 
63 63
 #
64 64
 #
65 65
 # 3. Build a docker image with the components required to build the docker binaries from source
... ...
@@ -79,8 +79,8 @@
79 79
 # 5. Copy the binaries out of the container, replacing HostPath with an appropriate destination 
80 80
 #    folder on the host system where you want the binaries to be located.
81 81
 #
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
84 84
 #
85 85
 #
86 86
 # 6. (Optional) Remove the interim container holding the built executable binaries:
... ...
@@ -172,7 +172,7 @@ ARG GO_VERSION=1.12.14
172 172
 #  - FROM_DOCKERFILE is used for detection of building within a container.
173 173
 ENV GO_VERSION=${GO_VERSION} `
174 174
     GIT_VERSION=2.11.1 `
175
-    GOPATH=C:\go `
175
+    GOPATH=C:\gopath `
176 176
     FROM_DOCKERFILE=1
177 177
 
178 178
 RUN `
... ...
@@ -249,7 +249,7 @@ RUN `
249 249
   Remove-Item C:\gitsetup.zip; `
250 250
   `
251 251
   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; `
253 253
   `
254 254
   Write-Host INFO: Configuring git core.autocrlf...; `
255 255
   C:\git\cmd\git config --global core.autocrlf true; `
... ...
@@ -260,7 +260,7 @@ RUN `
260 260
 ENTRYPOINT ["powershell.exe"]
261 261
 
262 262
 # 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
264 264
 
265 265
 # Copy the sources into the container
266 266
 COPY . .
... ...
@@ -100,8 +100,8 @@ To build Moby, run:
100 100
 Copy out the resulting Windows Moby Engine binary to `dockerd.exe` in the
101 101
 current directory:
102 102
 
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
105 105
 
106 106
 To test it, stop the system Docker daemon and start the one you just built:
107 107
 
... ...
@@ -109,7 +109,7 @@ To test it, stop the system Docker daemon and start the one you just built:
109 109
     .\dockerd.exe -D
110 110
 
111 111
 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'`.
113 113
 
114 114
 ### 6. Remove the interim binaries container
115 115
 
... ...
@@ -486,7 +486,7 @@ Try {
486 486
     }
487 487
 
488 488
     # 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"
490 490
 
491 491
     # After https://github.com/docker/docker/pull/30290, .git was added to .dockerignore. Therefore
492 492
     # we have to calculate unsupported outside of the container, and pass the commit ID in through
... ...
@@ -850,7 +850,7 @@ Try {
850 850
                 $Duration= $(Measure-Command { & docker run `
851 851
                                                         --rm `
852 852
                                                         -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" `
854 854
                                                         -v "$env:TEMP\binary`:c:\target" `
855 855
                                                         docker `
856 856
                                                         "`$env`:PATH`='c`:\target;'+`$env:PATH`;  `$env:DOCKER_HOST`='tcp`://'+(ipconfig | select -last 1).Substring(39)+'`:2357'; c:\target\runIntegrationCLI.ps1" | Out-Host } )