Last active
June 7, 2019 12:31
-
-
Save mattheusv/45d6d42c0c5c73872f79047ff002547b to your computer and use it in GitHub Desktop.
cross plataform compile with 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
| package main | |
| func main() { | |
| say() | |
| } |
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
| package main | |
| import "fmt" | |
| func say() { | |
| fmt.Println("linux") | |
| } |
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
| package main | |
| import "fmt" | |
| func say() { | |
| fmt.Println("windows") | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you running in a
linux amd 64architeture, the program will printlinux, or if you running in awindows amd 64architeture, the program will printwindowsOBS
if you add a function foo() in
say_windows_amd64.gofile, and not put your linux version intosay_linux_amd64.go, when you call this function onmain function, the program will not compile, tellingundefined foo()