commit | 1b9ab2716afa62aa4383b03b9561f73ae643d1eb | [log] [tgz] |
---|---|---|
author | Dmitri Shuralyov <dmitshur@golang.org> | Fri Jan 10 17:34:30 2020 -0500 |
committer | Dmitri Shuralyov <dmitshur@golang.org> | Mon Jan 13 21:05:48 2020 +0000 |
tree | a056ec7e2d55b9d58075f29dabd3b063a297a698 | |
parent | 8c015d2776df7d902eafabaab4dfbe5c316e47a7 [diff] |
internal/genv: find directory to write output with module mode in mind The goal of this change is to prevent genv from potentially writing its output in the wrong location. genv has been relying on os.Getenv("GOPATH") to figure out where to write its output. This stopped working reliably after Go 1.8 started having a default GOPATH value.¹ Back then, it was possible to start using 'go env GOPATH' instead. However, with the introduction of module mode in Go 1.11, there isn't a way to reliably pinpoint the canonical location of a development copy of a module, because that module can be placed in anywhere on the system. So, start requiring that genv is run inside the golang.org/dl module. At that point, it is possible to find the module root reliably. Add a Go 1.13+ build constraint in order to use errors.As without adding a requirement to golang.org/x/xerrors module. genv is a tool used only by contributors to this module, so it doesn't need to support Go 1.12. Also add a missing copyright header to a test file. ¹ https://golang.org/doc/go1.8#gopath Change-Id: Ia65e6cbb07d69481214708afaee15adb104f782c Reviewed-on: https://go-review.googlesource.com/c/dl/+/214386 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
This repository holds the Go wrapper programs that run specific versions of Go, such as go get golang.org/dl/go1.10.3
and go get golang.org/dl/gotip
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html. The main issue tracker for the net repository is located at https://github.com/golang/go/issues. Prefix your issue with “dl:” in the subject line, so it is easy to find.