Debian Codegraph @

test/env.go

raw
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 environment variables are accessible through
8 // package os.
9
10 package main
11
12 import (
13 "os"
14 "runtime"
15 )
16
17 func main() {
18 ga := os.Getenv("PATH")
19 if runtime.GOOS == "plan9" {
20 ga = os.Getenv("path")
21 }
22 if ga == "" {
23 print("PATH is empty\n")
24 os.Exit(1)
25 }
26 xxx := os.Getenv("DOES_NOT_EXIST")
27 if xxx != "" {
28 print("$DOES_NOT_EXIST=", xxx, "\n")
29 os.Exit(1)
30 }
31 }