-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: no way to go get
source code for editing in module mode
#31529
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
Comments
Note that There is currently some question as to what to do about |
Yep, that behavior is expected and intended. We want the choice to use an unreleased version (when released alternatives exist) to be explicit. You can always |
Generally we're trying to move the The alternative for developers is to run (See also #18387.) |
go get
source code while honoring go.modgo get
source code for editing in module mode
(CC @jayconrod, but I don't think we'll be able to make significant changes here until 1.14 at the earliest.) |
Thanks @bcmills for taking a quick look at this. (Sorry for the close+open earlier; my trackpad sometimes does phantom clicks.) I had always viewed But now with GO111MODULE=on, and with Go 1.13, I will need to view it almost solely as a dependency manager. (This is a significant change that I think is not obvious.) I agree it seems like a good idea to not get pre-releases by default... just makes the transition awkward since our beta release is the first to try using modules. Running @thepudds gave this 5-star explanation in Slack:
So now I think I have something I can tell the community, many of whom are currently having trouble building Caddy from source:
Thank you for the help, coming to understand this. I'll leave the issue open since being able to consolidate those steps into one command (like it has always been before) would be convenient, especially if one (like me! 😄) wants to continue to use a traditional GOPATH. In other words, being able to One last question: in the future, GOPATH is still where module dependencies will be stored (read-only); will it still be recommended and good practice to store working copies of repos in GOPATH? I ask because I really like its structure, but if it messes with go tooling + modules, I should try to avoid that... |
|
@bcmills can you explain in more details why was this behavior changed? I really liked the simple instructions to build a binary
didn't need to think what is my PWD and didn't need to create all parent folders etc. |
@krasi-georgiev @bcmills in addition to downloading source code (which has been discussed here already),
Or if
In Go 1.13 I really miss this functionality. Now I can't do this, or tell someone else to do it, without likely damaging some unrelated In other words, we used to have a great tool for downloading and installing source code and binaries, now we have a tool that might do that in a sane way depending on the context, or it might instead update module dependency requirements (and install the binary to It would be great if these two very separate use cases were not both crammed into the same command |
For example a quick twitter search shows lots of examples of people giving instructions to install their tool via I don't think updating a |
@jnjackins #30515 is the issue for that. |
"go get -d" does not download to GOPATH/src anymore: golang/go#31529 Use explicit "git clone" to the current directory as suggested in golang/go#31529 (comment) . Fixes rfjakob/gocryptfs#553
"go get -d" does not download to GOPATH/src anymore: golang/go#31529 Use explicit "git clone" to the current directory as suggested in golang/go#31529 (comment) . Fixes #553
Waiting on this. Having to specifically clone all of my projects to the right location in the tree in order to have the replaces all make sense in all actively developed modules just adds extra setup/accounting to development. I appreciate modules in all of their advantages, but it's backwards that this is no longer an automatic part of the workflow. Before, everything was self organizing. This somewhat reminds me of "automatically"- versus "manually"-installed packages in Ubuntu. The sourcecode for the project(s) passed as arguments to go-get will be brought down as source under $GOPATH/src though their dependencies (if a module) will be established under pkg/. If the dependencies are not modules then just bring those down as source as well. This should maintain the existing ethos of which stuff should be under pkg/ and which should be under src/. This probably oversimplifies the requirements and their ramifications, but any progress in this direction would be good. |
…orkflow documentation. As golang released their new version 1.17.1 go get is not supported anymore. golang/go#31529 (comment) suggests using 'git clone' rather than 'go get'.
…orkflow documentation. As golang released their new version 1.17.1 go get is not supported anymore. golang/go#31529 (comment) suggests using 'git clone' rather than 'go get'.
Now that the old "GOPATH" support in go get is gone, go get is primarily for updating your dependencies in go.mod. I don't think the functionality fits into the new purpose of go get. Will close this issue. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat are you trying to do?
(Added this question, hope that's OK.)
go get
a Go project's source code and install its command (the repo contains both a command and library packages) while respecting module dependencies.In the past we used
vendor
to pin dependencies, but we'd rather use Go modules.go get
has always worked great, even with an empty GOPATH. If possible, we'd like for the project to stay go-gettable.What did you do?
export GOPATH=
and ensure no~/go
folder exists)$ GO111MODULE=on go get github.com/mholt/testrepo/caddy
What did you expect to see?
The
$GOPATH/src
(~/go/src
) folder populated with the project's source code, and the binary installed to thebin
folder, while honoring the versions specified in go.mod.What did you see instead?
Only module folders were created.
How does one get the source code, with dependencies, while honoring
go.mod
?The one-step install flow of
go get
was really nice. Will this no longer be the case with Go 1.13 whenGO111MODULE=on
becomes the default behavior?More info
We're in an awkward position in our transition to modules. Many people are unable to build Caddy from source without some wrangling.
We've added go.mod and go.sum, removed our vendor folder, and tagged a beta release (in the actual repo, not my test repo here). Unfortunately, modules seem to ignore the beta release tag so all module operations fail unless we explicitly specify the beta version in our commands. So it is not obvious how to test that we've transitioned correctly.
Additionally, without modules (GO111MODULE=off), running
go get
on Caddy currently fails with:because one of our upstream dependencies have had a breaking change. Our go.mod pins the working version of this dependency, but
go get
does not honor this (yet?).But setting
GO111MODULE=on
also doesn't work because the beta version isn't recognized. The last non-prerelease tag doesn't use modules, so the build also fails.(As an aside,
@v1.0.0-beta1
needs to be specified explicitly, which (temporarily?) breaks our build instructions and isn't obvious... it confused a lot of people including me.)Even still, if we start over on the test repo but set
GO111MODULE=on
this time, it does not pull down the source code so we can start developing on it.If
go get
is how the GOPATH is populated for development, it should put the source code in it so we can develop with it. Ifgo get
becomes a command for a read-only workflow, what is the alternative for "developers" as opposed to just "builders"?The text was updated successfully, but these errors were encountered: