hound-search/hound

Use //go:embed from Go 1.16

simon04 opened this issue · 7 comments

https://golang.org/pkg/embed/

Package embed provides access to files embedded in the running Go program.

Go source files that import "embed" can use the //go:embed directive to initialize a variable of type string, []byte, or FS with the contents of files read from the package directory or subdirectories at compile time.

https://golang.org/doc/go1.16#library-embed

Hey! Just to clarify, are you proposing that this replaces ui/bindata.go and the go-bindatapackage?

Exactly, yes.

Ok, cool. We aren't going to prioritize this for the time being, but we are open to a PR.

Is this even considered There are two PRs raised against this last two years with no merge.

@inglor it is being considered. Alas, there are only a few of us, and we all have full-time jobs and have had a rocky few years. Thanks for being patient with us.

Seems like the main blocker is that with the switch to embed, a simple go install ... won't work anymore / people would need to have npm installed as well when compiling hound?

I'd agree with 3 points mentioned here: #430 (comment)

Regarding Commit the ui build artifacts to the repo:
That's actually what's already happening with bindata.go. Switching to embed would just shift that to different files.
(which I find somewhat dangerous. It's much easier to hide malicious stuff in "binified" go files or minified JS 😉; those build artifacts should not be part of the repo)

resolved by #460 and thank you!