Install Golang
Last updated
Was this helpful?
Last updated
Was this helpful?
To build TiDB from source code, you need to install Go in your development environment first. If Go is not installed yet, you can follow the instructions in this document for installation.
TiDB periodically upgrades its Go version to keep up with Golang. Currently, upgrade plans are announced on .
To get the right version of Go, take a look at the . You should see that there is a line like go 1.21
(the number may be different) in the first few lines of this file. You can also run the following command to get the Go version:
Now that you've got the version number, go to , choose the corresponding version, and then follow the .
If you are using Linux or MacOS, you can manage Go versions with easily.
To install gvm, run the following command:
Once you have gvm installed, you can use it to manage multiple different Go compilers with different versions. Let's install the corresponding Go version and set it as default:
Now, you can type go version
in the shell to verify the installation:
In the next chapter, you will learn how to obtain the TiDB source code and how to build it.
If you encounter any problems during your journey, do not hesitate to reach out on the .