Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Side by Side Diff: src/env.bash

Issue 4249045: code review 4249045: build: move $GOBIN ahead of /bin, /usr/bin in build $PATH (Closed)
Patch Set: diff -r 768498ada484 https://go.googlecode.com/hg Created 14 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 # Copyright 2009 The Go Authors. All rights reserved. 2 # Copyright 2009 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style 3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file. 4 # license that can be found in the LICENSE file.
5 5
6 export GOROOT=${GOROOT:-$(cd ..; pwd)} 6 export GOROOT=${GOROOT:-$(cd ..; pwd)}
7 7
8 if ! test -f "$GOROOT"/include/u.h 8 if ! test -f "$GOROOT"/include/u.h
9 then 9 then
10 echo '$GOROOT is not set correctly or not exported: '$GOROOT 1>&2 10 echo '$GOROOT is not set correctly or not exported: '$GOROOT 1>&2
(...skipping 11 matching lines...) Expand all
22 fi 22 fi
23 23
24 export GOBIN=${GOBIN:-"$GOROOT/bin"} 24 export GOBIN=${GOBIN:-"$GOROOT/bin"}
25 if [ ! -d "$GOBIN" -a "$GOBIN" != "$GOROOT/bin" ]; then 25 if [ ! -d "$GOBIN" -a "$GOBIN" != "$GOROOT/bin" ]; then
26 echo '$GOBIN is not a directory or does not exist' 1>&2 26 echo '$GOBIN is not a directory or does not exist' 1>&2
27 echo 'create it or set $GOBIN differently' 1>&2 27 echo 'create it or set $GOBIN differently' 1>&2
28 exit 1 28 exit 1
29 fi 29 fi
30 30
31 export OLDPATH=$PATH 31 export OLDPATH=$PATH
32 export PATH=/bin:/usr/bin:"$GOBIN":$PATH 32 export PATH="$GOBIN":/bin:/usr/bin:$PATH
33 33
34 MAKE=make 34 MAKE=make
35 if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then 35 if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
36 MAKE=gmake 36 MAKE=gmake
37 fi 37 fi
38 38
39 # Tried to use . <($MAKE ...) here, but it cannot set environment 39 # Tried to use . <($MAKE ...) here, but it cannot set environment
40 # variables in the version of bash that ships with OS X. Amazing. 40 # variables in the version of bash that ships with OS X. Amazing.
41 eval $($MAKE --no-print-directory -f Make.inc go-env | egrep 'GOARCH|GOOS|GOHOST ARCH|GOHOSTOS|GO_ENV') 41 eval $($MAKE --no-print-directory -f Make.inc go-env | egrep 'GOARCH|GOOS|GOHOST ARCH|GOHOSTOS|GO_ENV')
42 42
43 # Shell doesn't tell us whether make succeeded, 43 # Shell doesn't tell us whether make succeeded,
44 # so Make.inc generates a fake variable name. 44 # so Make.inc generates a fake variable name.
45 if [ "$MAKE_GO_ENV_WORKED" != 1 ]; then 45 if [ "$MAKE_GO_ENV_WORKED" != 1 ]; then
46 echo 'Did not find Go environment variables.' 1>&2 46 echo 'Did not find Go environment variables.' 1>&2
47 exit 1 47 exit 1
48 fi 48 fi
49 unset MAKE_GO_ENV_WORKED 49 unset MAKE_GO_ENV_WORKED
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b