Skip to content

Commit 9633195

Browse files
committed
src: do not emit warning when GOROOT_BOOTSTRAP is unset
Fixes #48155 Change-Id: I610a20d3af55035bb0b1047509361b204253801e Reviewed-on: https://go-review.googlesource.com/c/go/+/347273 Trust: Cuong Manh Le <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
1 parent 7609b50 commit 9633195

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/make.bash

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,17 @@ if [ "$1" = "-v" ]; then
152152
shift
153153
fi
154154

155+
goroot_bootstrap_set=${GOROOT_BOOTSTRAP+"true"}
155156
export GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
156157
export GOROOT="$(cd .. && pwd)"
157158
IFS=$'\n'; for go_exe in $(type -ap go); do
158159
if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
159160
goroot=$(GOROOT='' GOOS='' GOARCH='' "$go_exe" env GOROOT)
160161
if [ "$goroot" != "$GOROOT" ]; then
161-
printf 'WARNING: %s does not exist, found %s from env\n' "$GOROOT_BOOTSTRAP/bin/go" "$go_exe" >&2
162-
printf 'WARNING: set %s as GOROOT_BOOTSTRAP\n' "$goroot" >&2
162+
if [ "$goroot_bootstrap_set" = "true" ]; then
163+
printf 'WARNING: %s does not exist, found %s from env\n' "$GOROOT_BOOTSTRAP/bin/go" "$go_exe" >&2
164+
printf 'WARNING: set %s as GOROOT_BOOTSTRAP\n' "$goroot" >&2
165+
fi
163166
GOROOT_BOOTSTRAP=$goroot
164167
fi
165168
fi

src/make.rc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,20 @@ GOENV=off
5151
GOFLAGS=()
5252
GO111MODULE=()
5353
GOROOT = `{cd .. && pwd}
54-
if(! ~ $#GOROOT_BOOTSTRAP 1)
54+
goroot_bootstrap_set = 'true'
55+
if(! ~ $#GOROOT_BOOTSTRAP 1){
56+
goroot_bootstrap_set = 'false'
5557
GOROOT_BOOTSTRAP = $home/go1.4
58+
}
5659
for(p in $path){
5760
if(! test -x $GOROOT_BOOTSTRAP/bin/go){
5861
if(go_exe = `{path=$p whatis go}){
5962
goroot = `{GOROOT='' $go_exe env GOROOT}
6063
if(! ~ $goroot $GOROOT){
61-
echo 'WARNING: '$GOROOT_BOOTSTRAP'/bin/go does not exist, found '$go_exe' from env' >[1=2]
62-
echo 'WARNING: set '$goroot' as GOROOT_BOOTSTRAP' >[1=2]
64+
if(~ $goroot_bootstrap_set 'true'){
65+
echo 'WARNING: '$GOROOT_BOOTSTRAP'/bin/go does not exist, found '$go_exe' from env' >[1=2]
66+
echo 'WARNING: set '$goroot' as GOROOT_BOOTSTRAP' >[1=2]
67+
}
6368
GOROOT_BOOTSTRAP = $goroot
6469
}
6570
}

0 commit comments

Comments
 (0)