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

optimal command to compile from source #12

Open
danie-dejager opened this issue Jun 20, 2023 · 4 comments
Open

optimal command to compile from source #12

danie-dejager opened this issue Jun 20, 2023 · 4 comments
Labels
question Further information is requested

Comments

@danie-dejager
Copy link

What would be the preferred and optimal build command be?
I used:

GO111MODULE=on CGO_ENABLED=0 go build -v -trimpath -buildmode=pie -modcacherw -tags netgo -ldflags="-s -w"

I get a fairly decent binary at 5.1M but for instance I then cannot compress it with UPX.

@danie-dejager
Copy link
Author

Used one of your precompiled binaries at 4.8M, it was also compressed down to 1.6M

@fabio42
Copy link
Owner

fabio42 commented Jul 28, 2023

This repos is relying on goreleaser and and github actions to generate the releases binaries. As far as I know there is no way to use UPX with the current version. I would be happy to be proven wrong :)

@fabio42 fabio42 added the question Further information is requested label Jul 28, 2023
@danie-dejager
Copy link
Author

danie-dejager commented Jul 28, 2023

I could compress your release with upx 4.02 but not my build.

@fabio42
Copy link
Owner

fabio42 commented Aug 1, 2023

Oh ok, the release process is made by goreleaser. I'm not sure what parameters are used there exactly, but I will try to figure that out. Context always help, from you other question I understand you are trying to package this as an RPM, which is actually great :)

From the documentation and the config file I defined, it seems pretty basic, and should looks like this:

CGO_ENABLED=0 go build -ldflags="-s -w"

Another important parameter would be which version of go you use for the build step.
From the logs the version go version go1.20.4 linux/amd64 was used to produce the latest binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants