You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the useful ability to (cross)compile inside the container, is there a reason to recommend mapping myapp outside of GOPATH (currently: /usr/src/myapp)? Or is this an oversight?
I'm exploring using the golang container to compile programs and it seems (to this noob) that myapp would be better mapped within the GOPATH (see below) to support get'ing dependencies.
Currently:
docker run \
--volume=$PWD:/usr/src/myapp \
--workdir=/usr/src/myapp \
--env=GOOS=linux \
--env=GOARCH=amd64 \
golang go build -v
Propose documenting this as:
docker run \
--volume=$PWD:/go/src/myapp \
--workdir=/go/src/myapp \
--env=GOOS=linux \
--env=GOARCH=amd64 \
golang go build -v
which then permits:
docker run \
--volume=$PWD:/go/src/myapp \
--workdir=/go/src/myapp \
--env=GOOS=linux \
--env=GOARCH=amd64 \
golang bash -c 'go get -d ./... && go build .'
The text was updated successfully, but these errors were encountered:
With "Go Modules", GOPATH is now entirely optional, and is what I'd recommend using here. Using /usr/src/myapp is simply an example (it's up to users to adapt to suit their needs based on how Go works, as you've done). 👍
For the useful ability to (cross)compile inside the container, is there a reason to recommend mapping
myapp
outside ofGOPATH
(currently:/usr/src/myapp
)? Or is this an oversight?I'm exploring using the golang container to compile programs and it seems (to this noob) that
myapp
would be better mapped within theGOPATH
(see below) to support get'ing dependencies.Currently:
Propose documenting this as:
which then permits:
The text was updated successfully, but these errors were encountered: