Skip to content

Instantly share code, notes, and snippets.

@nobonobo
Created July 9, 2021 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobonobo/99e60744d8d3c8b9f680b3fa67d37261 to your computer and use it in GitHub Desktop.
Save nobonobo/99e60744d8d3c8b9f680b3fa67d37261 to your computer and use it in GitHub Desktop.
コンパイル日時をバイナリに埋める方法
> go build -ldflags "-X main.Build=$(date +%Y-%m-%dT%H:%M:%S)" sample.go
> ./sample.go
2021-07-09T12:41:11
package main
import "fmt"
var Build = "unknown"
func main() {
fmt.Println(Build)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment