Skip to content

Strip debugging information - #638

Merged
thebaer merged 1 commit into
writefreely:developfrom
zer-far:dev
Jul 8, 2023
Merged

Strip debugging information#638
thebaer merged 1 commit into
writefreely:developfrom
zer-far:dev

Conversation

@zer-far

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

Copy link
Copy Markdown
Contributor

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

thebaer commented Jan 31, 2023

Copy link
Copy Markdown
Member

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

zer-far commented Jan 31, 2023

Copy link
Copy Markdown
Contributor Author

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

thebaer commented Jan 31, 2023

Copy link
Copy Markdown
Member

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

zer-far commented Feb 1, 2023

Copy link
Copy Markdown
Contributor Author

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

thebaer commented Jul 8, 2023

Copy link
Copy Markdown
Member

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.

2 participants