Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
x/build/cmd/release: releaselet can be out of sync with cmd/release #33443
releaselet.go should be embedded in the cmd/release source, either as a simple constant, or with go:generate and https://github.com/shurcooL/vfsgen.
…uild.release This step was added in CL 188738 to work around the issue golang.org/issue/33443. That issue has now been resolved, so this step is no longer needed and can be removed. Updates #33443 Change-Id: I0c9257ab61d53f3a47556882f7dfc8fc119be849 Reviewed-on: https://go-review.googlesource.com/c/go/+/189942 Reviewed-by: Filippo Valsorda <firstname.lastname@example.org>
Previously, the release binary dynamically looked for the releaselet.go source code. It first checked in the current working directory, and then used the go/build package to find the location of source code of golang.org/x/build/cmd/release package on disk. The release binary is not generally executed by hand, rather it is used internally by releasebot command. That makes it hard to know in advance where the current working directory for release will be (that directory is $HOME/go-releasebot-work/<release> that releasebot creates itself). Further, with the proliferation of module mode, it's no longer viable to be able to find the location of a package by its import path via go/build.Import. As a result, there's now a higher risk of cmd/release not finding, or finding a wrong version of releaselet.go. Change the release binary to instead statically embed the releaselet.go source code as a constant string, in a static.go file that is generated via a go:generate directive. Add a test to ensure the embedded copy of releaselet.go doesn't get out of sync. The embedding approach was loosely based on approach taken in package golang.org/x/tools/godoc/static, but it was simplified for the smaller needs of cmd/release (i.e., embedding a single text file). We rely on fmt's %q verb to do the escaping, which has the risk of changing between Go versions, but it's unlikely to happen often to warrant worrying yet. Fixes golang/go#33443 Change-Id: Ie7a9481c33a7d9668d696d3827e5681b07b37094 Reviewed-on: https://go-review.googlesource.com/c/build/+/189817 Reviewed-by: Filippo Valsorda <email@example.com>