2012-02-17 04:48:57 +00:00
|
|
|
// run
|
2008-09-23 00:31:41 +00: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.
|
|
|
|
|
2023-05-08 14:47:45 +00:00
|
|
|
// Test that environment variables are accessible through
|
|
|
|
// package os.
|
2012-02-19 03:28:53 +00:00
|
|
|
|
2008-09-23 00:31:41 +00:00
|
|
|
package main
|
|
|
|
|
2011-03-30 21:24:32 +00:00
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"runtime"
|
|
|
|
)
|
2008-09-23 00:31:41 +00:00
|
|
|
|
|
|
|
func main() {
|
2023-05-08 14:47:45 +00:00
|
|
|
ga := os.Getenv("PATH")
|
|
|
|
if runtime.GOOS == "plan9" {
|
|
|
|
ga = os.Getenv("path")
|
|
|
|
}
|
|
|
|
if ga == "" {
|
|
|
|
print("PATH is empty\n")
|
2010-09-04 00:36:13 +00:00
|
|
|
os.Exit(1)
|
2008-09-23 00:31:41 +00:00
|
|
|
}
|
2012-02-19 05:18:13 +00:00
|
|
|
xxx := os.Getenv("DOES_NOT_EXIST")
|
|
|
|
if xxx != "" {
|
|
|
|
print("$DOES_NOT_EXIST=", xxx, "\n")
|
2010-09-04 00:36:13 +00:00
|
|
|
os.Exit(1)
|
2008-09-23 00:31:41 +00:00
|
|
|
}
|
|
|
|
}
|