How to compile and debug golang compiler source code on a personal computer

problem description

I have been in contact with golang for some time, and recently I am trying to set up an environment of golang compiler source code on my PC. I believe that I can learn more about the essence of golang through debugging. I believe that this can better learn more of the essence of go language, but I suffer from being unsuccessful, so I would like to consult all the great gods here. I hope they will not hesitate to teach me. Thank you very much!

May.11,2022

1. First, your system needs to be Linux or Unix .
2, computer hardware to meet the requirements (i7 CUP,8G RAM, at least 100G disk space)
3, the system needs to install all compilation dependencies, such as make . You can refer to how to build the deb package and the rpm package to set up the compilation environment. Other dependencies can be installed when compilation errors indicate a lack of dependencies.
4, to have enough patience, and strong English reading ability, because a lot of things in the compilation process need to repeatedly check the information in order to find the appropriate dependency package, and most of these dependent sites are open source, relatively old, need more profound technical skills to understand the entire process.
5. Be patient. When I compiled swift , my MacPro took at least 45 minutes , which is still when many dependencies have been compiled.


the go language has two compilers, gc and gccgo, both of which can be compiled on multiple platforms / systems.

refer to https://golang.org/doc/instal...

If a binary distribution is not available for your combination of operating system and architecture, try installing from source or installing gccgo instead of gc.

"go language Learning Notes" this book has a very detailed go source code analysis, I am also learning, I hope to encourage

The

environment is not complicated either. It mainly includes the following points:
1 Linux environment
2 install gdb debugging
3 clone
4 source code
4 write a simple demo, and debug through gdb

you can learn step by step from the entry how the functions are called, including memory management, garbage disposal, and so on.

Menu