Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for generated .go files (e.g. timestamp) #429

Open
bstarynk opened this issue Oct 30, 2018 · 0 comments
Open

support for generated .go files (e.g. timestamp) #429

bstarynk opened this issue Oct 30, 2018 · 0 comments

Comments

@bstarynk
Copy link

bstarynk commented Oct 30, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant