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

after setup GO111MODULE=on, how to download a denpendency package in any directory #29256

Closed
orange-jacky opened this issue Dec 14, 2018 · 5 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@orange-jacky
Copy link

orange-jacky commented Dec 14, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

i setup export GO111MODULE=off, i can download a denpendency package by go get xxx in anywhere
i setup export GO111MODULE=on, i can't download a denpendency package by go get xxx in anywhere

after create a tmp directory , and run go mod init tmp, and go get xxxx, it can download the xxx package
when i setup export GO111MODULE=on, i wish download a denpendency package by go get xxx in anywhere, can you tell me how to do ?

@orange-jacky orange-jacky changed the title after setup GO111MODULE=on, how to only download a denpendency package after setup GO111MODULE=on, how to download a denpendency package in any directory Dec 14, 2018
@ezxfv
Copy link

ezxfv commented Dec 14, 2018

import a library in you project and then in your project directory run go mod tidy

@orange-jacky
Copy link
Author

before not use go modules, you can download a library in any directory by running go get xxxx
after using go modules, you must entry a directory which have a go.mod file, than you can run go get xxx download library to $GOPATH/pkg/mod, it's hard than not use go modules.
i want to know that when i setup GO111MODULE=on, how to download a library in any directory without a go.mod file

@bcmills
Copy link
Contributor

bcmills commented Dec 14, 2018

Please clarify what you mean by “download”. What do you want to do with the package once you've downloaded it?

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 14, 2018
@orange-jacky
Copy link
Author

now

macbookpro:tmp fredlee$ go version
go version go1.11 darwin/amd64
macbookpro:tmp fredlee$ echo $GO111MODULE
on
macbookpro:tmp fredlee$ pwd
/Users/fredlee/Downloads/tmp
macbookpro:tmp fredlee$ go get github.com/gin-gonic/gin
go: cannot find main module; see 'go help modules'
macbookpro:tmp fredlee$ go mod init tmp
go: creating new go.mod: module tmp
macbookpro:tmp fredlee$ go get github.com/gin-gonic/gin
go: finding github.com/ugorji/go/codec latest
go: finding github.com/gin-contrib/sse latest
go: finding github.com/golang/protobuf/proto latest
go: downloading github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2
macbookpro:tmp fredlee$ ll
total 8.0K
-rw-r--r-- 1 fredlee staff 407 12 21 17:25 go.mod
-rw-r--r-- 1 fredlee staff 1.4K 12 21 17:25 go.sum
macbookpro:tmp fredlee$

i want

macbookpro:tmp fredlee$ go version
go version go1.11 darwin/amd64
macbookpro:tmp fredlee$ echo $GO111MODULE
on
macbookpro:tmp fredlee$ pwd
/Users/fredlee/Downloads/tmp
macbookpro:tmp fredlee$ go get github.com/gin-gonic/gin
go: finding github.com/ugorji/go/codec latest
go: finding github.com/gin-contrib/sse latest
go: finding github.com/golang/protobuf/proto latest
go: downloading github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2
macbookpro:tmp fredlee$ ll
macbookpro:tmp fredlee$

@bcmills
Copy link
Contributor

bcmills commented Dec 21, 2018

Use go1.12beta1. Both go get and go mod download should work outside of a module.

@bcmills bcmills closed this as completed Dec 21, 2018
@golang golang locked and limited conversation to collaborators Dec 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants