I am just starting a new Go project (a hobby project, GPLv3+, on gitlab, for some sort of wiki thing). I am using Linux/Debian/Sid with Go 1.11.1 and I don't care about non-Linux systems (so portability to Windows is not a concern).
I really want to have a small .go file generated at every build. That file just defines two strings (one for the build timestamp, one for its git commit).
This StackOverflow question describes what I have in mind. I would like to generate at every build some timestamp.go file having something similar to
// generated timestamp.go file
package timestamp
var Buildtime = "Tue 30 Oct 2018 09:39:01 AM MET";
var Buildlastgitcommit = "7fde394b60bc adding timestamp.go"
The Buildtime string is obtained by date +%c. The Buildlastcommit string is obtained by a few git commands.
Is godel the right tool for this? I cannot easily find in the documentation of godel how generated .go files are managed.
I am just starting a new Go project (a hobby project, GPLv3+, on gitlab, for some sort of wiki thing). I am using Linux/Debian/Sid with Go 1.11.1 and I don't care about non-Linux systems (so portability to Windows is not a concern).
I really want to have a small .go file generated at every build. That file just defines two strings (one for the build timestamp, one for its git commit).
This StackOverflow question describes what I have in mind. I would like to generate at every build some
timestamp.gofile having something similar toThe
Buildtimestring is obtained bydate +%c. TheBuildlastcommitstring is obtained by a fewgitcommands.Is godel the right tool for this? I cannot easily find in the documentation of godel how generated .go files are managed.