-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
go get
should support relative import paths (e.g. "./foo")
#3515
Comments
Not supporting local imports was a very deliberate decision. We understand the advantages, but there are also disadvantages. The most important one is that you cannot tell what a source file imports unless you know where it was found: copying a source file changes the meaning of its imports. This is not a good property for a language that is trying to be explicit and clear about dependency management. So, sorry, but we're not going to allow local imports in go get'able code. Also note that when you use local imports in other code, it means you are giving up on incremental compilation: the object files for local imports are never installed, so they cannot be reused. Status changed to WorkingAsIntended. |
How common is it to copy a single source file out of an entire project, and still expect it to work? I can't think of any other languages that have that property. In fact, even in Go I can't copy a single source file out of a project and still expect it to work, because packages can be (and often are) split up across multiple files. And if I'm copying all of the files in a package, it's not that much of an imposition to copy sub-packages. I would understand this as an argument against allowing ".." in an import path, but it just seems like a very weak argument against allowing "./foo". |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by kballard:
The text was updated successfully, but these errors were encountered: