How can I compile my project only relay on my vendor folder with go modules?

66 views
Skip to first unread message

唐彦昭

unread,
Jun 11, 2019, 5:11:57 AM6/11/19
to golang-nuts
I need put my project on the server to compile.But my server can't connect to internet.
So I need to put all my relay in my vendor folder in my develop environment.
How can I do this with go modules?

Henrik Johansson

unread,
Jun 11, 2019, 6:06:19 AM6/11/19
to 唐彦昭, golang-nuts
I think "go mod vendor"
 does the trick as stated in "go mod help vendor".

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e7f1ae76-3d41-494b-b771-0efc1a3c5784%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

andrey mirtchovski

unread,
Jun 11, 2019, 10:20:15 AM6/11/19
to 唐彦昭, golang-nuts
"go mod vendor" will populate the vendor directory in your project,
then "go build -mod=vendor" will only use that directory to build.
Reply all
Reply to author
Forward
0 new messages