thanos icon indicating copy to clipboard operation
thanos copied to clipboard

Replace go-bindata with a better alternative

Open GiedriusS opened this issue 3 years ago • 13 comments

Is your proposal related to a problem?

We currently use go-bindata and it is not maintained. Also, another (kind of unrelated) problem is that we capture the modification time of files hence we cannot run make assets on each build otherwise we'd pollute the commits.

Describe the solution you'd like

Prometheus and other related projects use vfsgen: https://github.com/prometheus/prometheus/issues/2411

I suggest moving to it. Plus, let's use a consistent modification time: https://github.com/prometheus/prometheus/pull/4731/files.

Describe alternatives you've considered

Not moving to anything at all and having the same issues. Relevant blog post: https://tech.townsourced.com/post/embedding-static-files-in-go/.

GiedriusS avatar Feb 10 '21 20:02 GiedriusS

I believe there might be a better way: Go 1.6 has a native solution for this: https://golangtutorial.dev/tips/embed-files-in-go/ go:embed

WDYT? 🤗

bwplotka avatar Feb 12 '21 17:02 bwplotka

Hey, can I work on this issue? :)

siddhartha97 avatar Feb 15 '21 03:02 siddhartha97

Hey, can I work on this issue? :)

Sure, feel free. The embed package looks great, we should try it.

GiedriusS avatar Feb 15 '21 16:02 GiedriusS

The embed package looks interesting but there is a slight difference in the approach with the embed package. With go-bindata you create the bindata.go file before running go build, which means that you don't need the actual files to successfully build the binary, you just need the generated bindata.go file. But go:embed directives work during the build phase, this means that every time you build the binary, you will need the React UI's production bundle to be available.

So essentially, if we switch to go embed, the build step will also include building the UI (which means one needs to have Node.js installed). On the flip side, this will remove the need of running make assets on each change to the UI and get rid of the merge conflicts in bindata.go, resulting in better DX. BTW Prometheus also does this now (building the UI too when you run make build).

WDYT?

onprem avatar Feb 18 '21 19:02 onprem

The embed package looks interesting but there is a slight difference in the approach with the embed package. With go-bindata you create the bindata.go file before running go build, which means that you don't need the actual files to successfully build the binary, you just need the generated bindata.go file. But go:embed directives work during the build phase, this means that every time you build the binary, you will need the React UI's production bundle to be available.

So essentially, if we switch to go embed, the build step will also include building the UI (which means one needs to have Node.js installed). On the flip side, this will remove the need of running make assets on each change to the UI and get rid of the merge conflicts in bindata.go, resulting in better DX. BTW Prometheus also does this now (building the UI too when you run make build).

WDYT?

It sounds great. So I just went ahead and make a PR. Although there's still a blocker from upstream Prometheus image not bumping to 1.16 yet.

longngn avatar Feb 20 '21 18:02 longngn

Hello 👋 Looks like there was no activity on this issue for the last two months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

stale[bot] avatar Jun 03 '21 02:06 stale[bot]

Closing for now as promised, let us know if you need this to be reopened! 🤗

stale[bot] avatar Jun 18 '21 02:06 stale[bot]

Still valid.

onprem avatar Jun 18 '21 10:06 onprem

Hello 👋 Looks like there was no activity on this issue for the last two months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

stale[bot] avatar Aug 18 '21 01:08 stale[bot]

Hello 👋 Looks like there was no activity on this issue for the last two months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

stale[bot] avatar Oct 30 '21 06:10 stale[bot]

Hello 👋 Looks like there was no activity on this issue for the last two months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

stale[bot] avatar Jan 09 '22 02:01 stale[bot]

Hello 👋 Looks like there was no activity on this issue for the last two months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

stale[bot] avatar Apr 16 '22 03:04 stale[bot]

Hello 👋 Looks like there was no activity on this issue for the last two months. Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

stale[bot] avatar Sep 21 '22 06:09 stale[bot]

@onprem how does opening a PR here work? first PR first serve or the team assigns the issue to a person and get to work on it exclusively?

Bexanderthebex avatar Oct 17 '22 09:10 Bexanderthebex

Feel free to work on it @Bexanderthebex!

matej-g avatar Oct 17 '22 09:10 matej-g

@Bexanderthebex , are you still working on it??

hackeramitkumar avatar Dec 03 '22 05:12 hackeramitkumar

After tracking through some of the open issues and closed PR requests in the prometheus repo, they looked like they moved away from vsfgen to embed.

https://github.com/prometheus/prometheus/pull/10220

Will using embed be a better alternative now?

nebula-aac avatar Aug 05 '23 00:08 nebula-aac

We moved to emded in #6900! Closing!

saswatamcode avatar Nov 18 '23 04:11 saswatamcode