markbates / pkger

Embed static files in Go binaries (replacement for gobuffalo/packr)
MIT License
1.19k stars 60 forks source link

Document that go:embed exists and is usually a better solution #150

Open rsheasby opened 3 years ago

saitho commented 2 years ago

I just tried go:embed on two files I included via pkger before. It worked, but I noticed my binary is larger than before.

With pkger: 27,18 MB With go:embed: 27,20 MB

rsheasby commented 2 years ago

20 kb or 0.07% smaller isn't really a good reason to keep using pkger. Fact is pkger doesn't really seem to be maintained anymore, and IIRC @markbates has encouraged using go:embed on the Go Time podcast. I suspect he just hasn't got around to marking the repo archived or updating the readme.

saitho commented 2 years ago

True, it isn't much. So far I didn't see a reason to use that, if it makes the file slightly larger. But if @markbates also encourages using go:embed, I'll probably do the switch. :D

rsheasby commented 2 years ago

I may be mistaken, don't quote me on that. But I seem to remember he said something about it on Go Time.

Regardless, that shouldn't be the primary reason for switching. The primary reason for switching is because go:embed is actively maintained and reduces dependencies. pkger is no longer maintained, and if you have one less thing to download and one less potential supply chain attack, it's a no brainer. Plus no more go generate pre-build step required.