Open perillo opened 4 years ago
Sounds reasonable to me!
Change https://golang.org/cl/221978 mentions this issue: dl: exit with the exit code returned by cmd.Run
In https://golang.org/cl/221978 I have added the internal/compat
package.
If the CL is approved, there are two functions, duplicated in gotip
and internal/version
packages, that can be moved there: homedir
and dedup
. The dedup
function also have duplicate tests.
I opened #37037 and have a CL chain for dl
that merges gotip
with version
. I've been waiting a month for review, but feasibly everything could live in internal/version
and avoid the extra package and simplify your CL.
In the end, excluding homedir
and dedup
, the remaining duplicate code is const caseInsensitiveEnv
, func exe
, func goroot
and the main
function.
I'm not against your CL, but I think having a compat
package for functions that have compatibility problems makes the code more readable.
I have updated https://golang.org/cl/221978. In addition to rebasing, I have also added the new go:build
directive.
Thanks.
@dmitshur, when you have time can you review https://golang.org/cl/221978? I think that it is ready to be merged.
Thanks.
@dmitshur, now that the dl
package requires go 1.18, using `exec.ExitError should be ok.
I have updated my CL.
Thanks.
Currently, the
Run
function in theinternal/version
andgotip
packages returns the exit status1
if the wrapped command fails:I'm developing a package that wraps various
go
commands, and I'm adding support for testing different versions of thego
tool. Unfortunately one test that checks for the exit status 2 now fails.I'm using this patched version locally: