2012-02-16 21:48:57 -07:00
|
|
|
// run
|
2008-09-22 18:31:41 -06:00
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
2012-02-18 20:28:53 -07:00
|
|
|
// Test that the Go environment variables are present and accessible through
|
|
|
|
// package os and package runtime.
|
|
|
|
|
2008-09-22 18:31:41 -06:00
|
|
|
package main
|
|
|
|
|
2011-03-30 15:24:32 -06:00
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"runtime"
|
|
|
|
)
|
2008-09-22 18:31:41 -06:00
|
|
|
|
|
|
|
func main() {
|
2012-02-18 22:18:13 -07:00
|
|
|
ga := os.Getenv("GOARCH")
|
2011-03-30 15:24:32 -06:00
|
|
|
if ga != runtime.GOARCH {
|
|
|
|
print("$GOARCH=", ga, "!= runtime.GOARCH=", runtime.GOARCH, "\n")
|
2010-09-03 18:36:13 -06:00
|
|
|
os.Exit(1)
|
2008-09-22 18:31:41 -06:00
|
|
|
}
|
2012-02-18 22:18:13 -07:00
|
|
|
xxx := os.Getenv("DOES_NOT_EXIST")
|
|
|
|
if xxx != "" {
|
|
|
|
print("$DOES_NOT_EXIST=", xxx, "\n")
|
2010-09-03 18:36:13 -06:00
|
|
|
os.Exit(1)
|
2008-09-22 18:31:41 -06:00
|
|
|
}
|
|
|
|
}
|