How to compile vegeta on condition that we cannot access golang.org?
Question
I have correctly prepared relevant tools including dep and make, but we cannot access golang.org throughout the nation, so each build ends up with similar mistakes as the following:
The following issues were found in Gopkg.toml: ✗ unable to deduce repository and source type for "golang.org/x/net": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://golang.org/x/net?go-get=1": Get http://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:80: connect: connection timed out
Even though I tried to use a proxy, it seems that dep just cannot use the proxy!
So my question is how to compile vegeta in such a network environment? Thanks a lot in advance.
I have successfully downloaded golang.org/x/net/http2 to local disk and tried to place it into proper directories, but the measure does not work.
I opened #469 to get rid of dep files since we can use go mod for everything. Maybe that helps. I'm wondering why you have to compile vegeta yourself though? Are you planning to contribute? Or use the library?
If not, just download one of the releases: https://github.com/tsenart/vegeta/releases
@tsenart Thanks for you kind response first. I want to adjust some code snips to verify some ideas emerged when using vegeta. It is true that sometime later maybe I want to contribute.
@fengnex: OK! Have you tried after #469 was merged?
@tsenart Thanks for your help!
Whenever I tried to run "make vegeta" to compile the latest version pulled from github, I still got the error as the following:
make vegeta
go get -u github.com/mailru/easyjson/...
go generate ./...
go: downloading golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
go: downloading golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
build command-line-arguments: cannot load golang.org/x/net/http2: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connect: connection timed out)
Bootstrap failed: exit status 1
lib/results.go:225: running "easyjson": exit status 1
go: downloading golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
build command-line-arguments: cannot load golang.org/x/net/http2: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connect: connection timed out)
lib/plot/plot.go:1: running "go": exit status 1
make: *** [generate] Error 1
One possibility is using the vendoring mode of go mod. Have you ever tried? I used this option to build in a machine that doesn't had access to internet.
Some steps to make it:
- You will need to download all dependencies using
go mod vendor - All dependencies will be downloaded to a path on your project called
vendor. So you can send this folder to any place. - To compile using this vendor data you will need to add the to the build command the flag
-mod vendor
Another option would be to point Go to a local go proxy with those dependencies already downloaded.
See https://arslan.io/2019/08/02/why-you-should-use-a-go-module-proxy/
:)
Sent from my iPhone
On 17 Jul 2020, at 14:29, Jair de Souza Junior [email protected] wrote:
One possibility is using the vendoring mode of go mod. Have you ever tried? I used this option to build in a machine that doesn't had access to internet.
Some steps to make it:
You will need to download all dependencies using go mod vendor All dependencies will be downloaded to a path on your project called vendor. So you can send this folder to any place. To compile using this vendor data you will need to add the to the build command the flag -mod vendor — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
There are pre-built binaries you can use. It's been a long time, so closing this.