1// run 2 3// Copyright 2009 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7// Test that the Go environment variables are present and accessible through 8// package os and package runtime. 9 10package main 11 12import ( 13 "os" 14 "runtime" 15) 16 17func main() { 18 ga := os.Getenv("GOARCH") 19 if ga != runtime.GOARCH { 20 print("$GOARCH=", ga, "!= runtime.GOARCH=", runtime.GOARCH, "\n") 21 os.Exit(1) 22 } 23 xxx := os.Getenv("DOES_NOT_EXIST") 24 if xxx != "" { 25 print("$DOES_NOT_EXIST=", xxx, "\n") 26 os.Exit(1) 27 } 28} 29