Golang post-compilation file too large problem processing

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

go1.9.2 out, there is a tool written in Golang to compile, just test it. I was under the WINDOWS10 64-bit test. Compiling and executing files is almost as efficient. But 1.9.2 compiled the file 6M.
Personally think this is a bit big, the key is the function is not complex. So I think this volume is simply too exaggerated, try to lose weight.

Size compiled with the original build
6,167kb

The Build section parameters view the results by removing partial connections and debugging.
-A forces all dependent packages to be compiled.
-S Remove symbolic information
-W Remove dwarf debug information, the resulting program can not be debugged with GDB
S and W are not recommended for use at the same time.
Go build-ldflags-w test.go
But the volume is still a little big.
4,236kb

Finally, it is only the shell compression. The tool address is as follows:
Https://github.com/upx/upx/releases
Execute command
Upx.exe-9-K "Test.exe"
The volume after compression
1,372kb

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.