diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
commit | 505c19580e0f43fe5224431459cacb7c21edd93d (patch) | |
tree | 79e2634c253d60afc0cc0b2f510dc7dcbb48497b /test/env.go | |
parent | 1336a7c91e596c423a49d1194ea42d98bca0d958 (diff) | |
download | golang-505c19580e0f43fe5224431459cacb7c21edd93d.tar.gz |
Imported Upstream version 1upstream/1
Diffstat (limited to 'test/env.go')
-rw-r--r-- | test/env.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/env.go b/test/env.go index 28113bcb0..972374679 100644 --- a/test/env.go +++ b/test/env.go @@ -1,9 +1,12 @@ -// $G $F.go && $L $F.$A && ./$A.out +// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// Test that the Go environment variables are present and accessible through +// package os and package runtime. + package main import ( @@ -12,18 +15,14 @@ import ( ) func main() { - ga, e0 := os.Getenverror("GOARCH") - if e0 != nil { - print("$GOARCH: ", e0.String(), "\n") - os.Exit(1) - } + ga := os.Getenv("GOARCH") if ga != runtime.GOARCH { print("$GOARCH=", ga, "!= runtime.GOARCH=", runtime.GOARCH, "\n") os.Exit(1) } - xxx, e1 := os.Getenverror("DOES_NOT_EXIST") - if e1 != os.ENOENV { - print("$DOES_NOT_EXIST=", xxx, "; err = ", e1.String(), "\n") + xxx := os.Getenv("DOES_NOT_EXIST") + if xxx != "" { + print("$DOES_NOT_EXIST=", xxx, "\n") os.Exit(1) } } |