Head over to Settings/Preferences | Tools | External Tools and add a new tool with the name: go2go. So, we’ll have to configure an External Tool to make this work.
go2 file, so let’s do that.Īt the moment, GoLand does not support running generics code based on the. You’ll immediately notice that the IDE prompts you to rename the file as a. Let’s create a Go modules project, using the SDK we just compiled as the project’s Go SDK and a new main.go file.įor the demonstration code here, we’ll use the “best-in-class” sorting algorithm, Bubble Sort, to sort some books by their price. Writing a generics-based Hello World example Once this process is done, we will have a Go version capable of interpreting the Go 2 Type Parameters proposal.
With this step complete, we can open the built-in Terminal of the IDE with Alt + F12 on Windows/Linux or Option + F12 on macOS and navigate to the src folder using cd src.įinally, let’s build Go itself by invoking the make.bat command on Windows or make.sh on Linux/macOS. If you need CGO, omit the CGO_ENABLED=0 variable. which means that you will not be able to use CGO and test Type Parameters. Note: In this example, we are disabling CGO before building Go.