Skip to content

Feature: embed required deps via a embed file that is behind a unused build flag #226

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

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

Waldeedle
Copy link
Contributor

@Waldeedle Waldeedle commented Mar 18, 2025

Basically by creating an embed go file, go recognizes the dependencies and downloads them along with the lilliput library code.
By using a build flag, that isn't actually called at build time, the embed.go file is not added so nothing is actually being embedded into the binary.

This downloads the deps for both linux and mac (tested on m1 and linux containers). I wonder if we could be fancy with the OS and download only the OS specific ones but this was sufficient for my use-case

closes #195

@Waldeedle Waldeedle force-pushed the feature/embed-deps branch 2 times, most recently from 5161d12 to 2090efa Compare March 18, 2025 22:09
@Waldeedle Waldeedle force-pushed the feature/embed-deps branch from 2090efa to 240ed26 Compare March 18, 2025 23:05
@Waldeedle
Copy link
Contributor Author

Waldeedle commented Mar 18, 2025

image
here is an example when using go's native dependency commands with my changes (in my case using go mod tidy and go mod vendor)

You can test this on any existing go project. The only change is needed in the go.mod file to point at my branch's commit in order to have it pull everything in.

replace github.com/discord/lilliput => github.com/waldeedle/lilliput v0.0.0-20250318230505-240ed26e1aff

@skidder
Copy link
Contributor

skidder commented Mar 19, 2025

Looks good, thanks for the PR!

@skidder skidder merged commit 349c944 into discord:master Mar 19, 2025
2 checks passed
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.

Question about embedding deps
2 participants