Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有什么好办法解决docker go get github timeout? #5

Open
xmsz opened this issue May 7, 2021 · 1 comment
Open

有什么好办法解决docker go get github timeout? #5

xmsz opened this issue May 7, 2021 · 1 comment

Comments

@xmsz
Copy link

xmsz commented May 7, 2021

FROM golang:1.16.3-stretch



RUN mkdir -p $GOPATH/src/golang.org/x/
RUN cd $GOPATH/src/golang.org/x/ && git clone https://github.com.cnpmjs.org/golang/net.git
RUN cd $GOPATH/src/golang.org/x/ &&  git clone https://github.com.cnpmjs.org/golang/sys.git
RUN go get github.com/awesome-fc/golang-runtime


直接部署,都会卡在最后一步,因为国内根本下不下来

如果设置了proxy

则出现

docker run --rm -it -v $(pwd):/tmp fc-go-runtime bash -c "go build -o /tmp/code//bootstrap /tmp/code/main.go"
/tmp/code/main.go:5:2: cannot find package "github.com/awesome-fc/golang-runtime" in any of:
	/usr/local/go/src/github.com/awesome-fc/golang-runtime (from $GOROOT)
	/go/src/github.com/awesome-fc/golang-runtime (from $GOPATH)
make: *** [build] Error 1
@yin1999
Copy link

yin1999 commented Aug 20, 2021

Enable Go Modules, and then using go get to get all packages.

go.mod

module xxx

go 1.17

require (
	golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
	golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
)

Dockerfile

RUN export GOPROXY=https://goproxy.cn,direct && go mod tidy && go mod download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants