mirror of
https://github.com/golang/go
synced 2024-11-22 04:24:39 -07:00
doc/effective_go: don't use ALL_CAPS for variable names.
R=r, dsymonds CC=golang-dev https://golang.org/cl/6826070
This commit is contained in:
parent
64b3e590c0
commit
3e2a888753
@ -1745,9 +1745,9 @@ initializer can be a general expression computed at run time.
|
||||
</p>
|
||||
<pre>
|
||||
var (
|
||||
HOME = os.Getenv("HOME")
|
||||
USER = os.Getenv("USER")
|
||||
GOROOT = os.Getenv("GOROOT")
|
||||
home = os.Getenv("HOME")
|
||||
user = os.Getenv("USER")
|
||||
goRoot = os.Getenv("GOROOT")
|
||||
)
|
||||
</pre>
|
||||
|
||||
@ -1770,17 +1770,17 @@ correctness of the program state before real execution begins.
|
||||
|
||||
<pre>
|
||||
func init() {
|
||||
if USER == "" {
|
||||
if user == "" {
|
||||
log.Fatal("$USER not set")
|
||||
}
|
||||
if HOME == "" {
|
||||
HOME = "/home/" + USER
|
||||
if home == "" {
|
||||
home = "/home/" + user
|
||||
}
|
||||
if GOROOT == "" {
|
||||
GOROOT = HOME + "/go"
|
||||
if goRoot == "" {
|
||||
goRoot = home + "/go"
|
||||
}
|
||||
// GOROOT may be overridden by --goroot flag on command line.
|
||||
flag.StringVar(&GOROOT, "goroot", GOROOT, "Go root directory")
|
||||
// goRoot may be overridden by --goroot flag on command line.
|
||||
flag.StringVar(&goRoot, "goroot", goRoot, "Go root directory")
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user