-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: Is GOPATH
going to be deprecated?
#30329
Comments
Hi, there's an outline of the path forward in the Go Modules in 2019 blog post, which I encourage you to read in full. Here's an outline with the information you're looking for: Go 1.11 (August 2018):
Go 1.12 (February 2019):
Go 1.13 (August 2019):
So yes: the current plan is to deprecate If you're starting a Go project now, my suggestion is to use 1.12 (not yet officially released, but it'll happen soon and we already have a release candidate you can use), and try to use the new MODULE system. |
Is there going to be support for internal packages directly, without the For example:
It could be written as:
Sadly this does not work yet, but are there any plans to support it? |
Hi @ALTree, I have a related question. When the |
Hmm yeah, and what about old go projects and |
GOPATH
going to be deprecated?GOPATH
going to be deprecated?
Internal packages are already fully supported, no replacements necessary. Visibility is based on the package import path, and the internal packages can be in the same module or a different one. (I would suggest keeping everything in the same module to the extent possible.) |
|
Thanks, @bcmills. :-) |
Oh, where can I read about it it more? I am currently using replaces to make it work as intended, but could not find a way to make it work without that. :/ All the things I have tried require it to be a hostname of some sort, it tries to do a HTTPS GET on it. So my question is: is there a way to refer to a subdirectory directly, such as When I try to use Worth noting that I am using packages for namespaces, and organization. I have packages inside So, "I would suggest keeping everything in the same module to the extent possible." is fine. I am using only one module, my project. It depends on internal packages, which I cannot import without adding them to What I am trying to know is, how to import internal packages and make it work with go modules without using |
Sorry about this question but could you clarify it? What do you mean with "I have to import internal packages by full import path" ? I have a project like so:
on go.mod I had to do: require MyProject/MyLocalPackage and go claims:
So it was forcing me to create go.mod files for subpackages too.
|
I have the same question. I did the same Using Also, running |
@RenathoAzevedo https://github.com/J7mbo/go-subdirectories-with-modules This repository seems to help, I believe. My issue was wrong module path in
Why not? If not this, then how do you break code into multiple .go files? I really don't need to use packages, but I don't know of any other way other than putting all .go files into the project's root directory, which can get quite messy. |
The original question has been answered, and I would like this thread not to turn into a big messy Q&A session about Go modules (we don't use the github issue tracker for this kind of stuff anyway). If anyone has any more questions, please see: https://github.com/golang/go/wiki/Questions. There are a few places that are better suited for them (like the golang-nuts mailing list, or the Go forum). Thank you. Closing here. |
Hello. I am going to create a new project but there are many ways to go about this. Is
GOPATH
really going to be deprecated in future versions of go? Because if so, I would not want to depend on it.Thanks in advance!
The text was updated successfully, but these errors were encountered: