Last active
August 2, 2020 02:18
-
-
Save FlowingSPDG/7292c81452f177ec2519391a9e51399a to your computer and use it in GitHub Desktop.
Goでコンパイル時に変数を埋め込む方法(ShellScript)
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
| Now=$(date +%Y.%m.%d.%H%M%S) | |
| go build -ldflags "-X main.buildedAt=$Now" |
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" | |
| ) | |
| var ( | |
| buildedAt = "" | |
| ) | |
| func main() { | |
| fmt.Println("Builded at:", buildedAt) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment