← 返回
开发者工具 中文

Go Install

Install Go 1.22 compiler on Linux, configure environment variables, and provide commands for development, testing, building, and dependency management.
在Linux上安装Go 1.22编译器,配置环境变量,并提供开发、测试、构建及依赖管理命令。
solidexu
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 560
下载
💾 10
安装
1
版本
#compiler#go#golang#latest

概述


Content-Disposition: form-data; name="file"; filename="SKILL.md"

Content-Type: application/octet-stream


name: go-install

version: 1.0.0

description: Install Go compiler on Linux for Go project compilation and testing


Go Compiler Installation

Install Go compiler on Linux for Go project development, compilation, and testing.

Use Cases

  • Go project development
  • Running unit tests
  • Compiling Go programs

Installation Steps

1. Check System Architecture

uname -m
# x86_64 = amd64
# aarch64 = arm64

2. Download and Install

amd64 (x86_64):

cd /tmp
curl -LO https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
tar -xzf go1.22.0.linux-amd64.tar.gz
mv go ~/go-sdk
rm go1.22.0.linux-amd64.tar.gz

arm64 (aarch64):

cd /tmp
curl -LO https://go.dev/dl/go1.22.0.linux-arm64.tar.gz
tar -xzf go1.22.0.linux-arm64.tar.gz
mv go ~/go-sdk
rm go1.22.0.linux-arm64.tar.gz

3. Configure Environment Variables

export PATH=$PATH:~/go-sdk/bin
export GOPATH=~/go
export GOROOT=~/go-sdk

4. Persist Configuration

Add to ~/.bashrc or ~/.profile:

echo 'export PATH=$PATH:~/go-sdk/bin' >> ~/.bashrc
echo 'export GOPATH=~/go' >> ~/.bashrc
echo 'export GOROOT=~/go-sdk' >> ~/.bashrc

5. Verify Installation

go version
go env GOPATH GOROOT

Common Commands

# Run tests
go test ./...

# Run tests with verbose output
go test ./... -v

# Build project
go build -o <output> ./cmd/<entry>

# Download dependencies
go mod download

# Tidy dependencies
go mod tidy

Resource Requirements

ItemValue
-------------
Download Size~65MB
Extracted Size~300MB
Memory512MB minimum
CPUSingle core sufficient

Notes

  1. Go has no runtime dependencies, single binary
  2. Extremely fast compilation, ideal for CI/CD
  3. Recommended to use LTS version (e.g., 1.22.x)
  4. GOPATH directory is auto-created

Version Selection

VersionDescription
----------------------
go1.22.xLTS stable (recommended)
go1.21.xPrevious stable
go1.23.xLatest

Download: https://go.dev/dl/


版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 20:28 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 427 📥 118,386
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,927
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,534