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

Strip debugging information #638

Merged
merged 1 commit into from Jul 8, 2023
Merged

Strip debugging information #638

merged 1 commit into from Jul 8, 2023

Conversation

zer-far
Copy link
Contributor

@zer-far zer-far commented Jan 31, 2023

Using go build -ldflags="-s -w" reduces the file size of the binary by about 11 MB (from 39 MB to 28 MB).


  • I have signed the CLA

@thebaer
Copy link
Member

thebaer commented Jan 31, 2023

Thanks for submitting this.

I'm not familiar with these build options -- is this going to make crash reports less useful? I think ideally we'd keep whatever info we need in the executable to get full stacktraces whenever the app panics, to be sure we can debug issues that come up.

@zer-far
Copy link
Contributor Author

zer-far commented Jan 31, 2023

I'm not sure but according to https://pkg.go.dev/cmd/link, -s would "Omit the symbol table and debug information." and -w would "Omit the DWARF symbol table.".

@thebaer
Copy link
Member

thebaer commented Jan 31, 2023

Got it. Before I can merge this, someone will need to confirm that when the application panic()s it still outputs useful information.

@zer-far
Copy link
Contributor Author

zer-far commented Feb 1, 2023

I added panic() to cmd/writefreely/main.go:

image

Then built a binary without -s -w and one with and they had the same output:

image

@thebaer thebaer added this to the 0.14 milestone Jul 8, 2023
@thebaer
Copy link
Member

thebaer commented Jul 8, 2023

Thanks again for this! Merging now.

@thebaer thebaer merged commit 5d5a853 into writefreely:develop Jul 8, 2023
@zer-far zer-far deleted the dev branch July 8, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants