Go: cmd/go: revisit tag selection on 'go get'

Created on 4 May 2016  路  8Comments  路  Source: golang/go

The docs say:

When checking out or updating a package, get looks for a branch or tag that matches the locally installed version of Go.

This is very poorly specified (if you have 1.6.2 and there's a 1.6 git tag, do you get the tagged revision?) and I'm not sure that it's useful. We should figure out whether people are using it and consider removing it entirely.

cc @rsc

FrozenDueToAge NeedsDecision early-in-cycle

Most helpful comment

At the time of checking, there were 46670 Go repositories on GitHub listed at godoc.org, with the following stats for go1.* branches:

       1  go15
     114  go1

The repositories were obtained by go get, Go version 1.7. The branches were determined via git branch | grep go1 in each repository, then normalized to account for detached HEADs and go1 vs origin/go1.

All 8 comments

When checking out or updating a package, get looks for a branch or tag that matches the locally installed version of Go. The most important rule is that if the local installation is running version "go1", get searches for a branch or tag named "go1". If no such version exists it retrieves the most recent version of the package.

Actually, this is the only rule.

We should figure out whether people are using it and consider removing it entirely.

At this point, I'd be very happy if it gets removed. I currently see very little use/benefit from that additional rule, but it does increase complexity (amount of things to keep in one's mind, implement in other tools, etc.). Of course, I'm open to hearing arguments why it's useful, but so far I am unaware of any.

I thought there was more here when I suggested removing it. It may be that there's not enough here to worry about. But I'd still like to see stats about how many Go repos on Github have a go1 revision (tag or branch).

@rsc
you can try bigquery on Github.
https://bigquery.cloud.google.com/savedquery/865293014305:d80546b8c7414468ae79204288ea22e2

I had run out of quota, however the query shows only 937 files that pointing to refs that named "go1"

At the time of checking, there were 46670 Go repositories on GitHub listed at godoc.org, with the following stats for go1.* branches:

       1  go15
     114  go1

The repositories were obtained by go get, Go version 1.7. The branches were determined via git branch | grep go1 in each repository, then normalized to account for detached HEADs and go1 vs origin/go1.

According to the BigQuery's public GitHub data set, what's below are the only repos with a go1 branch. Beware that some of the items on the list are just forks.

c9s/go.matrix
xiuzhifu/Go-Redis
porridge/goexif
bdotdub/goexif
gamelost/bot3
op/goexif
ariefsam/Go-Redis
jmptrader/go.matrix
narula/ddtxn
rohanraja/go.matrix
alphazero/Go-Redis
skelterjohn/go.matrix
rodaine/goexif
kladd/goexif
rwcarlsen/goexif
doomalove/Go-Redis
gamelost/bot3server
postfix/goexif
ngaut/ddtxn

It appears that the selection of local version string is a little loose. I have a user who has found that go get for biogo/biogo fails because it tries to checkout the go1 tagged commit - this happens for go1.7.4 and go1.8rc1. I can remove the tag, but this behaviour seems counter to this https://github.com/golang/go/issues/15533#issuecomment-216696029"

The most important rule is that if the local installation is running version "go1", get searches for a branch or tag named "go1". If no such version exists it retrieves the most recent version of the package.

Obsoleted by modules, thank goodness.

Was this page helpful?
0 / 5 - 0 ratings