-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Replace go-bindata by vfsgen #4430
Conversation
With go generate support, there isn't any need anymore to check in the generated files, right? That would remove the need to remind contributors to run |
51ada91
to
32127b1
Compare
@grobie I'm not sure. AFAICT it is more a personal preference: some projects like kubernetes still commit all the generated code. I don't have any personal preference though. |
983aa5a
to
fe42e80
Compare
@brian-brazil can you have a look? |
web/ui/README.md
Outdated
This will put `go-bindata` in DEBUG mode where it serves from your local filesystem. | ||
To make this work, add `-tags dev` to the `flags` entry in `.promu.yml`, and then `make build`. | ||
|
||
This will serves all files from your local filesystem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serve
Makefile
Outdated
cd $(PREFIX)/web/ui && go generate | ||
|
||
$(VFSGENDEV): | ||
cd $(PREFIX)/vendor/github.com/shurcooL/vfsgen/ && go install ./cmd/vfsgendev/... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should be modifying the user's environment like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I've replaced vfsgen
by a custom helper program that does the same (just a couple of lines).
8393ae6
to
2cc3596
Compare
Makefile
Outdated
@$(GO) get -u github.com/jteeuwen/go-bindata/... | ||
@go-bindata $(bindata_flags) -pkg ui -o web/ui/bindata.go -ignore '(.*\.map|bootstrap\.js|bootstrap-theme\.css|bootstrap\.css)' web/ui/templates/... web/ui/static/... | ||
@$(GO) fmt ./web/ui | ||
$(GO) get -u github.com/shurcooL/vfsgen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed given its vendored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I have removed it from vendor/
in the last version because otherwise govendor ilst +unused
complains that it isn't used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't sound right, assets_generate.go is referencing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has a // +build ignore
constraint https://github.com/prometheus/prometheus/pull/4430/files#diff-eb481951f2846eb52fb4b11bfa5b8afdR14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a blank import has made govendor
happy.
👍 |
I'm not aware that anyone is actively reviewing the code generated by go-bindata / vfsgen, so I don't see a use case for actually checking in that file. As it's now possible to easily generate the files during compilation time on-the-fly, I'd vote to remove the need to ask every contributor to remember executing |
@brian-brazil @juliusv what are your views on this? |
If we've gotten the system to a place where it's no longer required, I see no issue with removing it. |
Ah, now I remember the issue with |
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This avoids installing vfsgendev in the target environment. Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
4efdda4
to
e2a487d
Compare
@grobie yep it seems to be the less disruptive way for now. Also when the generated code isn't committed, we need to add the |
@grobie @brian-brazil are you ok merging this? I'll take of migrating AlertManager and Pushgateway too. |
I already gave a +1 |
Thanks, great work @simonpasquier! |
Closes #2411.
Looking at https://tech.townsourced.com/post/embedding-static-files-in-go/ (which was mentioned in the issue), vfsgen has all the needed features.
In particular:
go generate
.