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

build smaller binaries, add version subcommand #333

Merged
merged 6 commits into from May 13, 2024
Merged

Conversation

tobert
Copy link
Member

@tobert tobert commented May 13, 2024

A PR came in to add -s -w to build ldflags, which will reduce binary sizes. Since the PR only updated /Dockerfile, these will only impact locally-built binaries.

This PR adds the flags to goreleaser and github actions builds to be consistent.

Along the way I noticed that I never exposed the version information in otel-cli, so I added that too.

-s -w to build smaller binaries
-X options to fill in version, commit, and date
Ensures testing happens with a binary closer to what goreleaser will
build.
With gzip encoding enabled it's difficult to compare content-length
header because side-effects can easily break it.

The test harness now automatically ignores content-length in HTTP
headers unless the test fixture specifically sets an expected result.
@@ -39,6 +39,9 @@ builds:
goarch: 386
- goos: freebsd
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}
Copy link
Contributor

Choose a reason for hiding this comment

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

👏


- linker flags now contain `-s -w` to reduce binary size
- change made in build Dockerfile, goreleaser, and GH Actions
- contribution from @Ipmi-13, thank you!
Copy link
Contributor

Choose a reason for hiding this comment

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

💁‍♂️ 🎩

@tobert tobert merged commit 0512be6 into main May 13, 2024
1 check 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.

None yet

2 participants