]> Cypherpunks repositories - gostls13.git/commitdiff
src: emit warning when make.bash run with invalid GOROOT_BOOTSTRAP
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 9 Jun 2021 07:26:36 +0000 (14:26 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 2 Sep 2021 07:31:53 +0000 (07:31 +0000)
When setting an invalid GOROOT_BOOTSTRAP, make.bash try looking at env to
find a valid go command and use that GOROOT instead. It's better if the
script emit a warning, instead of silently change the GOROOT_BOOTSTRAP.

Change-Id: I6038093d5e8c072da27bcae44b125f6774f809a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/326030
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/make.bash
src/make.rc

index 7986125a06ffc652016aef3252a24f6337379ea9..9ff471d863801cfd47ba0b3898f68f2918ea54db 100755 (executable)
@@ -158,6 +158,8 @@ IFS=$'\n'; for go_exe in $(type -ap go); do
        if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
                goroot=$(GOROOT='' GOOS='' GOARCH='' "$go_exe" env GOROOT)
                if [ "$goroot" != "$GOROOT" ]; then
+                       printf 'WARNING: %s does not exist, found %s from env\n' "$GOROOT_BOOTSTRAP/bin/go" "$go_exe" >&2
+                       printf 'WARNING: set %s as GOROOT_BOOTSTRAP\n' "$goroot" >&2
                        GOROOT_BOOTSTRAP=$goroot
                fi
        fi
index 7bdc7dea1c1eefde25478f71b970b2466512b41c..29d8c675db481fed50e8067bab2640a7729781d4 100755 (executable)
@@ -58,6 +58,8 @@ for(p in $path){
                if(go_exe = `{path=$p whatis go}){
                        goroot = `{GOROOT='' $go_exe env GOROOT}
                        if(! ~ $goroot $GOROOT){
+                               echo 'WARNING: '$GOROOT_BOOTSTRAP'/bin/go does not exist, found '$go_exe' from env' >[1=2]
+                               echo 'WARNING: set '$goroot' as GOROOT_BOOTSTRAP' >[1=2]
                                GOROOT_BOOTSTRAP = $goroot
                        }
                }