Skip to content

Instantly share code, notes, and snippets.

@peterbourgon
Created February 6, 2015 08:58
Show Gist options
  • Save peterbourgon/2c26e976e3f1bd312e3c to your computer and use it in GitHub Desktop.
Save peterbourgon/2c26e976e3f1bd312e3c to your computer and use it in GitHub Desktop.
$ cat main.go
package main
var x = "abc"
func main() {
println(x)
}
$ cat alt.go
// +build testing
package main
func init() {
x = "def"
}
$ go build
$ ./xxx
abc
$ rm ./xxx
$ go build -tags=testing
$ ./xxx
def
$ rm ./xxx
$ go build -tags=testing ; go build ; ./xxx
abc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment