Skip to content

Notes on 'go get'

Pavel Korotkov edited this page Jan 15, 2014 · 2 revisions

As we write these notes (Jan 15, 2014), 'go get' implementation at the latest go revision (and at previous ones) was tuned to recognize 'go1' tag only.

The corresponding piece of code on the current tip looks like:

// selectTag returns the closest matching tag for a given version.
// Closest means the latest one that is not after the current release.
// Version "goX" (or "goX.Y" or "goX.Y.Z") matches tags of the same form.
// Version "release.rN" matches tags of the form "go.rN" (N being a floating-point number).
// Version "weekly.YYYY-MM-DD" matches tags like "go.weekly.YYYY-MM-DD".
//
// NOTE(rsc): Eventually we will need to decide on some logic here.
// For now, there is only "go1".  This matches the docs in go help get.
func selectTag(goVersion string, tags []string) (match string) {
	for _, t := range tags {
		if t == "go1" {
			return "go1"
		}
	}
	return ""

So, currently there is no way to say that go1.0 users should take revision X, go1.1 users should take revision Y, and go1.2 users should take revision Z.

Seelog has some incompatibilities between go1.0 and go1.1 revisions and corresponding tags ('go1.0', 'go1.1', etc.) are set on the revisions that were compatible to the go version specified in these tags.

But, as you can see from the temporary code above, these tags are currently ignored and if we set 'go1' tag, go1.0, go1.0.3, go1.1, go1.2, go1.* users would get this specific revision via 'go get'. However, obviously, they must get different ones because they can be incompatible.

Initially we set go1 tag and got issues, that go1.1 and go1.2 people didn't get the latest revisions.

The solution

Because of that, we decided not to use go1 tag to avoid such situations. If you need to be sure that you include Seelog once and it never breaks because of a new revision, currently there are two options:

  1. Fork Seelog at the revision you need and then use 'go get'
  2. Don't use 'go get'. Use 'git clone' and update to the revision you need.

Future

We believe that current 'go get' behavior is temporary. Even the comments in 'selectTag' func state it so. Thus, this article is just an explanation of any issues connected with incompatible version retrieval by 'go get'.

Clone this wiki locally