Skip to content
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

x/build/version: prepend $PATH with $GOROOT/bin #23635

Closed
dolmen opened this issue Jan 31, 2018 · 5 comments

Comments

@dolmen
Copy link

@dolmen dolmen commented Jan 31, 2018

What version of Go are you using (go version)?

go1.9.3, but trying go1.10rc1

Does this issue reproduce with the latest release?

Yes: golang/build@46a0bbc

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="darwin"

What did you do?

$ go version
go version go1.9.3 darwin/amd64
$ go get golang.org/x/build/version/go1.10rc1
$ go1.10rc1 download
$ go get golang.org/x/tools/godoc
$ cd "$(go env GOPATH)/src/golang.org/x/tools/godoc/static"
$ go1.10rc1 generate
# runtime/internal/sys
compile: version "go1.10rc1" does not match go tool version "go1.9.3"
gen.go:7: running "go": exit status 2

What did you expect to see?

go1.10rc1 generate should succeed.

Workaround

$ PATH="$(go1.10rc1 env GOROOT)/bin:$PATH" go1.10rc1 generate

Suggested fix

Prepend $PATH with $GOROOT/bin in golang.org/x/version Run

@gopherbot gopherbot added this to the Unreleased milestone Jan 31, 2018
@gopherbot gopherbot added the Builders label Jan 31, 2018
@bradfitz

This comment has been minimized.

Copy link
Member

@bradfitz bradfitz commented Jan 31, 2018

Sorry, there's not enough information here. Before evaluating your solution, we need to understand the problem. It's nice that you provided a repo, but it doesn't include information about your environment.

Are you sure you included all the steps? Why is golang.org/x/version.Run even relevant here? I don't see you using the go1.10rc1 binary in your steps above.

@bradfitz bradfitz changed the title x/build/version.Run: prepend $PATH with $GOROOT/bin x/build/version: prepend $PATH with $GOROOT/bin Jan 31, 2018
@dolmen

This comment has been minimized.

Copy link
Author

@dolmen dolmen commented Jan 31, 2018

Sorry. My original submission had a typo: it mentioned go generate instead of go1.10rc1 generate. I have fixed it.

@bradfitz

This comment has been minimized.

Copy link
Member

@bradfitz bradfitz commented Oct 24, 2018

Looks like this was already fixed in https://go-review.googlesource.com/c/dl/+/143545 (dup of #28103).

/cc @dmitshur

@bradfitz bradfitz closed this Oct 24, 2018
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 25, 2018

Change https://golang.org/cl/144617 mentions this issue: version: make golang.org/dl replacement more visible

gopherbot pushed a commit to golang/build that referenced this issue Oct 25, 2018
The golang.org/x/build/version/... packages have been deprecated
in favor of golang.org/dl/... in CL 123678, as part of golang/go#23223.

Make this more visible by pointing to the new packages in the package
documentation.

Use a godoc.org link to avoid confusion, because these import paths
are hard tell apart from normal URLs that have a different meaning.

Updates golang/go#23635.
Updates golang/go#23223.

Change-Id: Ide6371f24fa2369b2807987c83df4226cacfe35d
Reviewed-on: https://go-review.googlesource.com/c/144617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 10, 2018

Change https://golang.org/cl/148881 mentions this issue: version: convert to generated copy of golang.org/dl/internal/version

gopherbot pushed a commit to golang/build that referenced this issue Dec 11, 2018
Package version has been copied from golang.org/x/build/version to
golang.org/dl/internal/version as part of golang/go#23223. The old
package was marked deprecated but kept for backwards compatibility
reasons. Fixes and changes have not been backported from the new
dl/internal/version package (to avoid spending time unproductively).

bundle has recently been updated to accept an empty prefix in CL 105515.

This allows one to use bundle to make a generated copy of a package.
A generated copied package is better than a manually-maintained copied
package for the following reasons:

1. Keeping the copied package up to date with upstream is low effort,
   just need to run go generate.

2. It's clear to contributors that the copied package isn't the
   canonical version, since there is a generated comment like
   "// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT."
   at the top of the file. It's easy to reject changes to the copied
   package, or redirect them to the upstream.

Overall, making the copied package generated rather than hand-written
reduces the maintenace cost, and makes it more viable to keep it more
up to date with upstream.

The diff to version.go in this CL is due to some dl/internal/version
CLs being effectively backported by bundle, including CL 134435,
CL 143545, and CL 144698.

Updates golang/go#23223
Fixes golang/go#23635

Change-Id: Id8cd63c52b660b6817e6fdba080373966789e1e8
Reviewed-on: https://go-review.googlesource.com/c/148881
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Nov 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.