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

[Feature] Make it possible to statically compile binary (disable CGo) #4103

Open
its-josh4 opened this issue Sep 10, 2023 · 0 comments · May be fixed by #4106
Open

[Feature] Make it possible to statically compile binary (disable CGo) #4103

its-josh4 opened this issue Sep 10, 2023 · 0 comments · May be fixed by #4106

Comments

@its-josh4
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The current codebase requires CGo to be compiled, which means that binaries cannot be statically compiled and cross-compilation is complex.

This is especially complex for contributors who are trying to build updated Docker images.

Describe the solution you'd like
I would like to be able to compile stash without CGo, to be able to cross-compile. I'm especially interested in building for Linux and Docker.

There are 2 dependencies that depend on CGo:

  1. https://github.com/kermieisinthehouse/systray -> This is already "optional" and only used on Mac and Windows, so isn't useful for Docker users. We can use build tags to exclude it if CGo is available AND building for Windows or Mac.
  2. https://github.com/mattn/go-sqlite3 -> Can be replaced with (modernc.org/sqlite)[https://pkg.go.dev/modernc.org/sqlite], which is pure-Go. It's almost a drop-in replacement, but it will require some changes to how user-defined SQLite functions are loaded (they are supported by this package but the code needs to change slightly).

Describe alternatives you've considered
Continue to cross-compile, which is especially painful when trying to build Docker images.

Additional context
Should make it easier for contributors to the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant