1// run fake-arg-to-force-use-of-go-run
2
3//go:build cgo && !windows
4
5// Copyright 2020 The Go Authors. All rights reserved.
6// Use of this source code is governed by a BSD-style
7// license that can be found in the LICENSE file.
8
9package main
10
11// #include <stdlib.h>
12// #include <unistd.h>
13import "C"
14
15import "os"
16
17func main() {
18	os.Setenv("FOO", "bar")
19	s := C.GoString(C.getenv(C.CString("FOO")))
20	if s != "bar" {
21		panic("bad setenv, environment variable only has value \"" + s + "\"")
22	}
23	os.Unsetenv("FOO")
24	s = C.GoString(C.getenv(C.CString("FOO")))
25	if s != "" {
26		panic("bad unsetenv, environment variable still has value \"" + s + "\"")
27	}
28}
29