Created
December 7, 2013 04:18
-
-
Save mindscratch/7837213 to your computer and use it in GitHub Desktop.
go using underscores in front of import package names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // $GOPATH/src/foo/foo.go | |
| package foo | |
| import "fmt" | |
| func init() { | |
| fmt.Println("foo init") | |
| } | |
| func init() { | |
| fmt.Println("foo init again") | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // $GOPATH/main.go | |
| package main | |
| import _ "foo" | |
| import "fmt" | |
| func main() { | |
| fmt.Println("in main") | |
| } | |
| // RUN: | |
| // > go run main.go | |
| foo init | |
| foo init again | |
| in main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment