summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/generate_env.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/testdata/script/generate_env.txt')
-rw-r--r--src/cmd/go/testdata/script/generate_env.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/generate_env.txt b/src/cmd/go/testdata/script/generate_env.txt
new file mode 100644
index 0000000..2df1663
--- /dev/null
+++ b/src/cmd/go/testdata/script/generate_env.txt
@@ -0,0 +1,32 @@
+# Install an env command because Windows and plan9 don't have it.
+env GOBIN=$WORK/tmp/bin
+go install env.go
+[plan9] env path=$GOBIN${:}$path
+[!plan9] env PATH=$GOBIN${:}$PATH
+
+# Test generators have access to the environment
+go generate ./printenv.go
+stdout '^GOARCH='$GOARCH
+stdout '^GOOS='$GOOS
+stdout '^GOFILE='
+stdout '^GOLINE='
+stdout '^GOPACKAGE='
+stdout '^DOLLAR='
+
+-- env.go --
+package main
+
+import (
+ "fmt"
+ "os"
+)
+
+func main() {
+ for _, v := range os.Environ() {
+ fmt.Println(v)
+ }
+}
+-- printenv.go --
+package main
+
+//go:generate env \ No newline at end of file