> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/ask/flat/chapter-21-development-environments/di-21.6-jie-go-kai-fa-huan-jing.md).

# 21.6 Go Development Environment

The Go language was developed by Google and is a programming language with native concurrency support.

This section configures the Go language development environment on FreeBSD, including toolchain installation and version settings.

## Installing Go

Install using pkg:

```sh
# pkg install go
```

Or install using Ports:

```sh
# cd /usr/ports/lang/go/
# make install clean
```

> **Note**
>
> The Go version number `go1.25.10` in this section is the Ports version at the time of writing. Please adjust according to the latest Go version available in FreeBSD Ports, which can be queried with `pkg search go`.

After successful installation, check the installed Go language version information:

```sh
$ go version
go version go1.25.10 freebsd/amd64
```

## A Blessing for a Beautiful World

Create a new text file `helloWorld.go` and add the following content:

```go
package main // Declare the main package; the program entry package must be main

import "fmt" // Import the fmt package for formatted output

func main() { // Main function, program entry
	fmt.Println("Hello, World!") // Print "Hello, World!" to the console
}
```

After saving, run the following command in the terminal to execute the program:

```sh
$ go run helloWorld.go
Hello, World!
```

## JetBrains GoLand IDE

Install JetBrains GoLand IDE using pkg:

```sh
# pkg install jetbrains-goland
```

Or install using Ports:

```sh
# cd /usr/ports/devel/jetbrains-goland/
# make install clean
```

![JetBrains GoLand IDE interface example](/files/XZ3ajcaWxKCP4j2TJiV9)

## References

* Go Project. Effective Go\[EB/OL]. \[2026-04-17]. <https://go.dev/doc/effective_go>. Official Go language best practices document, introducing idiomatic patterns and concurrency models.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/ask/flat/chapter-21-development-environments/di-21.6-jie-go-kai-fa-huan-jing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
