Configure and troubleshoot golangci-lint for Go projects. Handle import resolution issues, type-checking problems, and optimize configurations for both local and CI environments.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install go-linter-configuration或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install go-linter-configuration⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/go-linter-configuration/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: go-linter-configuration description: "Configure and troubleshoot golangci-lint for Go projects. Handle import resolution issues, type-checking problems, and optimize configurations for both local and CI environments." metadata: { "openclaw": { "emoji": "🔍", "requires": { "bins": ["go", "golangci-lint"] }, "install": [ { "id": "golang", "kind": "script", "script": "curl -L https://golang.org/dl/go1.21.5.linux-amd64.tar.gz | tar -C /usr/local -xzf -", "bins": ["go"], "label": "Install Go", }, { "id": "golangci", "kind": "script", "script": "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1", "bins": ["golangci-lint"], "label": "Install golangci-lint", }, ], }, } ---
Configure and troubleshoot golangci-lint for Go projects. This skill helps handle import resolution issues, type-checking problems, and optimize configurations for both local and CI environments.
Install golangci-lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
Or use the official installation script:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
Run linter on entire project:
golangci-lint run ./...
Run with specific configuration:
golangci-lint run --config .golangci.yml ./...
run:
timeout: 5m
tests: false
build-tags: []
linters:
disable-all: true
enable:
- gofmt # Format checking only
linters-settings:
gofmt:
simplify: true
issues:
exclude-use-default: false
max-issues-per-linter: 50
max-same-issues: 3
output:
format: tab
run:
timeout: 5m
tests: true
build-tags: []
linters:
enable:
- gofmt
- govet
- errcheck
- staticcheck
- unused
- gosimple
- ineffassign
linters-settings:
govet:
enable:
- shadow
errcheck:
check-type-assertions: true
staticcheck:
checks: ["all"]
issues:
exclude-use-default: false
max-issues-per-linter: 50
max-same-issues: 3
output:
format: tab
Problem: Linter reports undefined references to imported packages Solution: Use minimal configuration with disable-all: true and only enable basic linters like gofmt
Problem: CI environment cannot resolve dependencies properly Solution:
go mod download before running linter in CIProblem: Linter fails during type checking phase Solution:
--fast flag for quicker, less intensive checksFor GitHub Actions workflow:
name: Code Quality
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Download dependencies
run: go mod download
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
- name: Lint
run: golangci-lint run --config .golangci.yml ./...
Choose linters based on project needs and CI performance requirements.
安装 Go Linter Configuration 后,可以对 AI 说这些话来触发它
Help me get started with Go Linter Configuration
Explains what Go Linter Configuration does, walks through the setup, and runs a quick demo based on your current project
Use Go Linter Configuration to configure and troubleshoot golangci-lint for Go projects
Invokes Go Linter Configuration with the right parameters and returns the result directly in the conversation
What can I do with Go Linter Configuration in my developer & devops workflow?
Lists the top use cases for Go Linter Configuration, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/go-linter-configuration/ 目录(个人级,所有项目可用),或 .claude/skills/go-linter-configuration/(项目级)。重启 AI 客户端后,用 /go-linter-configuration 主动调用,或让 AI 根据上下文自动发现并使用。
Go Linter Configuration 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Go Linter Configuration 可免费安装使用。请查阅仓库了解许可证信息。
Configure and troubleshoot golangci-lint for Go projects. Handle import resolution issues, type-checking problems, and optimize configurations for both local and CI environments.
Go Linter Configuration 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Go Linter Configuration
Identifies repetitive steps in your workflow and sets up Go Linter Configuration to handle them automatically