Go 安装

v1.0.0

在 Linux 系统安装并配置 Go 编译器,支持 Go 项目编译、测试及依赖管理操作。

0· 267·3 current·4 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for solidexu/go-install-zh.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Go 安装" (solidexu/go-install-zh) from ClawHub.
Skill page: https://clawhub.ai/solidexu/go-install-zh
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Canonical install target

openclaw skills install solidexu/go-install-zh

ClawHub CLI

Package manager switcher

npx clawhub@latest install go-install-zh
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description (install and configure Go on Linux) match the instructions: downloading Go tarball from go.dev, extracting to ~/go-sdk, and setting PATH/GOPATH/GOROOT for development and testing.
Instruction Scope
Instructions stay within the stated purpose and do not ask for unrelated files or credentials. Minor issues: the guide does not include checksum or signature verification for the downloaded tarball (a recommended hardening step), and it asserts "GOPATH directory will be auto created" without explicitly creating ~/go; also recommends using ~/go-sdk rather than common system locations (which is a user choice).
Install Mechanism
No install spec or code files; downloads are from the official go.dev domain (expected for this purpose). No archive extraction to privileged locations and no elevated (sudo) operations are suggested.
Credentials
No environment variables, credentials, or config paths are requested beyond setting PATH/GOPATH/GOROOT for the user's shell — all proportional to installing and using Go.
Persistence & Privilege
Skill is user-invocable and not always-enabled; it does not request persistent elevated privileges or modify other skills/configs. The recommended changes are limited to the user's shell rc file.
Assessment
This is a straightforward, coherent install guide for Go on Linux. Before running the suggested commands: 1) consider verifying the downloaded tarball checksum or signature from the official Go releases page to reduce supply-chain risk; 2) decide whether to install to ~/go-sdk (user-local) or a system location like /usr/local (may require sudo); 3) explicitly create your GOPATH directory if you want it now (mkdir -p ~/go); and 4) review appended lines in ~/.bashrc and reload your shell (source ~/.bashrc) or log out/in. Avoid running commands from unknown sources without verifying URLs and checksums.

Like a lobster shell, security has layers — review code before you run it.

compilervk978z0e82wtj9e1xvt5gefhmk982j6kxgovk978z0e82wtj9e1xvt5gefhmk982j6kxgolangvk978z0e82wtj9e1xvt5gefhmk982j6kxlatestvk978z0e82wtj9e1xvt5gefhmk982j6kxzhvk978z0e82wtj9e1xvt5gefhmk982j6kx
267downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

name: go-install-zh version: 1.0.0 description: 在 Linux 环境安装 Go 编译器,用于 Go 项目编译和测试

Go 编译器安装

在 Linux 环境安装 Go 编译器,用于 Go 项目编译和测试。

适用场景

  • Go 项目开发
  • 运行单元测试
  • 编译 Go 程序

安装步骤

1. 确认系统架构

uname -m
# x86_64 = amd64
# aarch64 = arm64

2. 下载并安装

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. 配置环境变量

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

4. 持久化配置

添加到 ~/.bashrc~/.profile

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

5. 验证安装

go version
go env GOPATH GOROOT

常用命令

# 运行测试
go test ./...

# 运行测试(详细输出)
go test ./... -v

# 编译项目
go build -o <output> ./cmd/<entry>

# 下载依赖
go mod download

# 整理依赖
go mod tidy

资源需求

项目数值
安装包大小~65MB
解压后大小~300MB
内存需求最低 512MB
CPU 需求单核即可

注意事项

  1. Go 无运行时依赖,单二进制文件
  2. 编译速度极快,适合 CI/CD
  3. 建议使用 LTS 版本(如 1.22.x)
  4. GOPATH 目录会自动创建

版本选择

版本说明
go1.22.xLTS 稳定版(推荐)
go1.21.x旧稳定版
go1.23.x最新版

下载地址: https://go.dev/dl/ --------------------------80187b9f2f8945b5--

Comments

Loading comments...