Skip to content
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

Utilize builtin go "embed" package to embed all static files needed by internal viewer UI #785

Closed
wants to merge 8 commits into from

Conversation

mapl
Copy link

@mapl mapl commented Jun 12, 2021

dist folder not included in source

@mapl mapl requested review from ARolek and gdey as code owners June 12, 2021 22:57
@ARolek
Copy link
Member

ARolek commented Jun 25, 2021

I'm a big fan of this PR, but we're in a peculiar situation where we need to keep supporting the old way of embedding assets. In an ideal situation, we could use go build flags to sniff the version of Go that's being used for building and use the embed package when the version is 1.16 or greater.

cc @gdey

Copy link
Member

@ARolek ARolek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. No real comments. @gdey any feedback? You have more experience with embed.

Copy link
Member

@gdey gdey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to look at the build failure. We may need to move the build of the assets around; seems to be failing to find the dist dir according to the CI. (This is when it's running the tests; so we may need to just include the dist dire and a file)

server/viewer_embed.go Show resolved Hide resolved
server/viewer.go Show resolved Hide resolved
ui/embed.go Outdated
@@ -0,0 +1,23 @@
// +build !noViewer go1.16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then shouldn't this be !noViewer,go1.16?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.
I have now completely omitted the +built constraint in embed.go
It doesn't seem to matter because "embed.go" is only referred in "viewer_embed.go" which is only considered when built with go 1.16+
It compiled fine with no tag set and with -tag NoViewer on Go1.15.14.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6dfae95f3-PR-785

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 45.0%

Totals Coverage Status
Change from base Build 126d51113: -0.05%
Covered Lines: 5427
Relevant Lines: 12060

💛 - Coveralls

@ARolek
Copy link
Member

ARolek commented Jul 28, 2021

@mapl can you squash these commits when you have a chance? this is just about ready to be merged.

@mapl
Copy link
Author

mapl commented Jul 30, 2021

I made some git mistakes and decided to open another PR for this.

@mapl mapl closed this Jul 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants