Avoid debugging information on golang

后端 未结 2 1459
一向
一向 2020-12-24 03:12

I think that gc includes debugging information by default. However, I want to avoid decompilation.

How can I remove the debugging information when compiling go code

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-24 03:58

    I recommend usage of -ldflags="-s -w" which removes symbol table and debugging information.

    As a bonus with Go 1.13 -trimpath can be used to reduce length of file paths stored in the file

提交回复
热议问题