- Open a terminal in the directory with the file .
- Set the ulimit parameter to unlimited:
ulimit -c unlimited
. - Build the program by running
go build
. in the terminal. The build command creates a binary file in the current project folder (for example,awesomeProject
).
4.To create a core dump file, runGOTRACEBACK=crash ./<binary_file_name>
(for example,GOTRACEBACK=crash ./awesomeProject
). This command creates a core file in the current project folder.
参考链接: https://www.jetbrains.com/help/go/exploring-go-core-dumps.html