On Mon, Mar 4, 2024 at 8:52 PM Jeffery Carr <basilarc...@gmail.com> wrote:

> On Monday, March 4, 2024 at 8:44:14 AM UTC-6 Bryan C. Mills wrote:
>
> Per https://go.dev/doc/go1.22#go-command:
> > go get is no longer supported outside of a module in the legacy GOPATH mode
> (that is, with GO111MODULE=off). Other build commands, such as go build
>  and go test, will continue to work indefinitely for legacy GOPATH
>  programs.
>
> This was discussed in https://go.dev/issue/60915, which simultaneously
> proposed to preserve `go build` and `go test` and to finish removing `go
> get` in GOPATH mode. (That proposal was a change to the plan stated in
> https://go.dev/blog/go116-module-changes, which said: “We plan to drop
> support for GOPATH mode in Go 1.17.” That clearly did not happen as planned
> in Go 1.17.)
>
>
> Thank you for the helpful link to 60915.
>
> GO111MODULE=off go get <go-import-path> I used because it was a very easy
> way to git clone my programs and all the packages in the correct go import
> paths.
>
> If my go.work file is:
> go 1.22.0
>
> use (
> mygit.test.org/apps/myapp
> mygit.test.org/lib/myapppackage1
> myothergitserver.org/lib/myotherfunthing2
> friendsproject.org/someotherpackage3
> )
>
> How do I git clone the repos? I just don't seem to understand what I'm
> supposed to do.
>

Part of the intent with modules is that you do not need to do a full `git
clone` of each dependency — you should really only need to do that if you
need to author upstream changes yourself, in which case you can use `git
clone` directly (instead of having the `go` command do that).

I made the go path mapping to the git clone paths, so obviously I can write
> something to do this, but using 'go get' before to do the git clone was
> really easy! Especially since it got all the dependencies also.
>
> Again, thanks for the help,
> jcarr
>
> BTW,
> go list -json -m go.uber.org/zap@latest
>
> @latest doesn't show the URL so one can't really get the current URL sent
> from the go-import/go-source lines.  Actually, it doesn't seem like "go
> list" hits the external authoritative server at all and maybe only looks at
> the local ~/go/pkg/ files.
>

The Go proxy doesn't necessary serve origin information for
previously-fetched modules, but you can force the use of the upstream git
server using `GOPROXY=direct`:
$ go clean -modcache
$ GOPROXY=direct go list -json -m go.uber.org/zap@latest
{
        "Path": "go.uber.org/zap",
        "Version": "v1.27.0",
        "Query": "latest",
        "Time": "2024-02-20T20:55:06Z",
        "GoMod": "/tmp/tmp.9jWBoIG4kn/.gopath/pkg/mod/cache/download/
go.uber.org/zap/@v/v1.27.0.mod",
        "GoVersion": "1.19",
        "Origin": {
                "VCS": "git",
                "URL": "https://github.com/uber-go/zap";,
                "Hash": "fcf8ee58669e358bbd6460bef5c2ee7a53c0803a",
                "TagSum": "t1:nyhl6oz//aQZM1r8apo5oy5HcHnpycepirvxAqo5MIE=",
                "Ref": "refs/tags/v1.27.0"
        }
}


>
>
> The simplest way to download Go dependencies for code review and debugging
> is to run `go mod vendor` in your module or (newly added) `go work vendor`
> in your workspace. Also note that `go mod download -json` and `go list -m
> -json` now include origin information in most cases:
>
> ~$ go list -json -m go.uber.org/z...@v1.27.0
> <http://go.uber.org/zap@v1.27.0>
> ...
>
>
>
>                 "VCS": "git",
>                 "URL": "https://github.com/uber-go/zap";,
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/mxP3SKA5QoM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/17d6e3dd-4687-4474-b2cd-f44aa702f436n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/17d6e3dd-4687-4474-b2cd-f44aa702f436n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAKWVi_T-SOXFMbpunZDgywPiBmJDXcZFBCprhVd1513ava%3Dm4w%40mail.gmail.com.

Reply via email to