hound icon indicating copy to clipboard operation
hound copied to clipboard

Use //go:embed from Go 1.16

Open simon04 opened this issue 4 years ago • 3 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

simon04 avatar Feb 19 '21 22:02 simon04

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

salemhilal avatar Mar 30 '21 18:03 salemhilal

Exactly, yes.

simon04 avatar Mar 30 '21 18:03 simon04

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

salemhilal avatar Mar 30 '21 18:03 salemhilal

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

inglor avatar May 04 '23 11:05 inglor

@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.

salemhilal avatar May 04 '23 14:05 salemhilal

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: https://github.com/hound-search/hound/pull/430#issuecomment-1172640962

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)

moson-mo avatar May 04 '23 22:05 moson-mo

resolved by https://github.com/hound-search/hound/pull/460 and thank you!

dschott68 avatar Jun 08 '23 15:06 dschott68