Skip to main content

Go Installation Guide

This guide provides all the key information and getting-started instructions after a successful Go development environment installation via DeploySage-CLI.

Installation Information

Below are the details for your new Go installation.

ItemValue
Go Versione.g., 1.24.0
Go Root (GOROOT)/usr/local/go
Go Path (GOPATH)$HOME/go
Environment File/etc/profile.d/go.sh

Activate Environment

Common Commands

Quick Start

To start using Go, you must first source the environment file in your current terminal session, or simply log out and log back in.

After activating the environment, you can use the standard Go toolchain.

Follow these steps to create and run your first Go program.

# Activate for the current session
source /etc/profile.d/go.sh
# Check the installed version
go version

# View environment variables
go env

# Run a Go program
go run main.go

# Build an executable
go build main.go

# Initialize a new module
go mod init my-project

# Tidy dependencies
go mod tidy
# Create a project directory
mkdir -p ~/go/src/hello
cd ~/go/src/hello

# Create a Go source file
cat > main.go << 'EOF'
package main

import "fmt"

func main() {
fmt.Println("Hello, Go!")
}
EOF

# Run the program
go run main.go

Advanced Configuration

go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOSUMDB=sum.golang.google.cn
go env -w GOPRIVATE=your-private-repo.com