Created
July 9, 2019 13:50
-
-
Save ianfoo/225101fb9a59d5c7754e6c9673970c5a to your computer and use it in GitHub Desktop.
V2 packages in go
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
| $ for f in main.go fooprinter.go foo/foo.go foo/v2/foo.go; do echo -e "\n======= $f ======="; cat $f; done | |
| ======= main.go ======= | |
| package main | |
| import "./foo" | |
| func main() { | |
| foo.Print() | |
| printFooV2() | |
| } | |
| ======= fooprinter.go ======= | |
| package main | |
| import "./foo/v2" | |
| func printFooV2() { | |
| foo.Print() | |
| } | |
| ======= foo/foo.go ======= | |
| package foo | |
| import "fmt" | |
| func Print() { | |
| fmt.Println("Foo") | |
| } | |
| ======= foo/v2/foo.go ======= | |
| package foo | |
| import "fmt" | |
| func Print() { | |
| fmt.Println("Foo V2") | |
| } | |
| $ go run *.go | |
| Foo | |
| Foo V2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment