-
Notifications
You must be signed in to change notification settings - Fork 43
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
Moving location of statuszTmpl #206
Conversation
When trying to run $GOPATH/bin/stackdriver-prometheus-sidecar --help ,I get error panic: open statusz-tmpl.html: no such file or directory. Moving the intialization of the statuszTmpl to func ServeHTTP which allows the use of --help
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 don't think this one solve the real issue for a locally built binary - If the locally built binary runs the function ServeHTTP
, it will panic again.
Potential solutions is to either package the statusz-tmpl.html
into the binary, or use a const/variable to hold the template directly rather than parsing from files.
I decided to go with using a const that holds the template since I wasn't able to find a way to build the template into a go binary. Please let me know if that commit works |
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.
Maybe 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.
Thank you, it looks great. JUst one comment to address, please.
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.
@jkohen moved it to the init method. I have a a question using promu to build the binary. When I run "go build" in the directory "cmd/stackdriver-prometheus-sidecar", the generated binary runs as expected. However when I use the Makefile that runs the "promu build", the binary generated is against the old version of code(I can tell because of the error message and line number). Is this WAI or I'm running promu wrong ?
I see in the Travis presubmit results that the build is failing due to a missing dependency in the vendor
directory. If you are running go build
without -mod=vendor
, then the compiler is picking up the statik package from your local workstation. The makefile uses -mod=vendor
, so it's failing to build the binary, and I assume you're running a pre-existing binary.
You should be able to fix this by running go mod vendor
.
LGTM. @StevenYCChou you own this review, please merge when you're satisfied with it. |
@fifiug can you ensure the test passes? |
@StevenYCChou test passed. My pull request can't access the COVERALLS_TOKEN so "make goveralls" fails |
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.
LGTM. Thanks for the contribution, @fifiug !
* Moving var statuszTmpl to func ServeHTTP When trying to run $GOPATH/bin/stackdriver-prometheus-sidecar --help ,I get error panic: open statusz-tmpl.html: no such file or directory. Moving the intialization of the statuszTmpl to func ServeHTTP which allows the use of --help * Moving statusz-tmpl.html to a const in statusz.go and updating related files. * Using statik as a code generator * Updating statusz.go * Updating statusz.go and main.go * Updating statusz.go * Adding dependcies from running go mod vendor * Updating statik Co-authored-by: Javier Kohen <jkohen@gmail.com>
When trying to run $GOPATH/bin/stackdriver-prometheus-sidecar --help ,I get error panic: open statusz-tmpl.html: no such file or directory.
Moving the intialization of the statuszTmpl to func ServeHTTP which allows the use of --help