blob: 972374679ac83d387bb97dfe3f0a714e14ba3830 [file] [log] [blame]
Russ Cox0b477ef2012-02-16 23:48:57 -05001// run
Rob Pike4d12c0e2008-09-22 17:31:41 -07002
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
Rob Pike83976e32012-02-19 14:28:53 +11007// Test that the Go environment variables are present and accessible through
8// package os and package runtime.
9
Rob Pike4d12c0e2008-09-22 17:31:41 -070010package main
11
Ian Lance Taylore0087572011-03-30 14:24:32 -070012import (
13 "os"
14 "runtime"
15)
Rob Pike4d12c0e2008-09-22 17:31:41 -070016
17func main() {
Brad Fitzpatrickefacb2a2012-02-18 21:18:13 -080018 ga := os.Getenv("GOARCH")
Ian Lance Taylore0087572011-03-30 14:24:32 -070019 if ga != runtime.GOARCH {
20 print("$GOARCH=", ga, "!= runtime.GOARCH=", runtime.GOARCH, "\n")
Rob Pike4f61fc92010-09-04 10:36:13 +100021 os.Exit(1)
Rob Pike4d12c0e2008-09-22 17:31:41 -070022 }
Brad Fitzpatrickefacb2a2012-02-18 21:18:13 -080023 xxx := os.Getenv("DOES_NOT_EXIST")
24 if xxx != "" {
25 print("$DOES_NOT_EXIST=", xxx, "\n")
Rob Pike4f61fc92010-09-04 10:36:13 +100026 os.Exit(1)
Rob Pike4d12c0e2008-09-22 17:31:41 -070027 }
28}