← 返回 Skills 市场
1541
总下载
2
收藏
8
当前安装
3
版本数
在 OpenClaw 中安装
/install go
功能描述
Write reliable Go code avoiding goroutine leaks, interface traps, and common concurrency bugs.
使用说明 (SKILL.md)
Quick Reference
| Topic | File |
|---|---|
| Concurrency patterns | concurrency.md |
| Interface and type system | interfaces.md |
| Slices, maps, strings | collections.md |
| Error handling patterns | errors.md |
Goroutine Leaks
- Goroutine blocked on channel with no sender = leak forever—always ensure channel closes or use context
- Unbuffered channel send blocks until receive—deadlock if receiver never comes
for rangeon channel loops forever until channel closed—sender mustclose(ch)- Context cancellation doesn't stop goroutine automatically—must check
ctx.Done()in loop - Leaked goroutines accumulate memory and never garbage collect
Channel Traps
- Sending to nil channel blocks forever—receiving from nil also blocks forever
- Sending to closed channel panics—closing already closed channel panics
- Only sender should close channel—receiver closing causes sender panic
- Buffered channel full = send blocks—size buffer for expected load
selectwith multiple ready cases picks randomly—not first listed
Defer Traps
- Defer arguments evaluated immediately, not when deferred function runs—
defer log(time.Now())captures now - Defer in loop accumulates—defers stack, run at function end not iteration end
- Defer runs even on panic—good for cleanup, but recover only in deferred function
- Named return values modifiable in defer—
defer func() { err = wrap(err) }()works - Defer order is LIFO—last defer runs first
Interface Traps
- Nil concrete value in interface is not nil interface—
var p *MyType; var i interface{} = p; i != nilis true - Type assertion on wrong type panics—use comma-ok:
v, ok := i.(Type) - Empty interface
anyaccepts anything but loses type safety—avoid when possible - Interface satisfaction is implicit—no compile error if method signature drifts
- Pointer receiver doesn't satisfy interface for value type—only
*Thas the method
Error Handling
- Errors are values, not exceptions—always check returned error
err != nilafter every call—unchecked errors are silent bugserrors.Isfor wrapped errors—==doesn't work withfmt.Errorf("%w", err)- Sentinel errors should be
var ErrFoo = errors.New()not recreated - Panic for programmer errors only—return error for runtime failures
Slice Traps
- Slice is reference to array—modifying slice modifies original
- Append may or may not reallocate—never assume capacity
- Slicing doesn't copy—
a[1:3]shares memory witha - Nil slice and empty slice differ—
var s []intvss := []int{} copy()copies min of lengths—doesn't extend destination
Map Traps
- Reading from nil map returns zero value—writing to nil map panics
- Map iteration order is random—don't rely on order
- Maps not safe for concurrent access—use
sync.Mapor mutex - Taking address of map element forbidden—
&m[key]doesn't compile - Delete from map during iteration is safe—but add may cause issues
String Traps
- Strings are immutable byte slices—each modification creates new allocation
rangeover string iterates runes, not bytes—index jumps for multi-byte charslen(s)is bytes, not characters—useutf8.RuneCountInString()- String comparison is byte-wise—not Unicode normalized
- Substring shares memory with original—large string keeps memory alive
Struct and Memory
- Struct fields padded for alignment—field order affects memory size
- Zero value is valid—
var wg sync.WaitGroupworks, no constructor needed - Copying struct with mutex copies unlocked mutex—always pass pointer
- Embedding is not inheritance—promoted methods can be shadowed
- Exported fields start uppercase—lowercase fields invisible outside package
Build Traps
go buildcaches aggressively—use-aflag to force rebuild- Unused imports fail compilation—use
_import for side effects only init()runs before main, order by dependency—not file ordergo:embedpaths relative to source file—not working directory- Cross-compile:
GOOS=linux GOARCH=amd64 go build—easy but test on target
安全使用建议
This is a documentation-only skill with Go best-practice notes and no hidden installs or network endpoints. The only minor mismatch is the declared required binary (go): it is reasonable for a Go helper but the skill text does not actually instruct running the go tool. If you plan to allow the agent to execute commands on your machine, be aware the agent could still choose to run local binaries (including go) at runtime — review and control the agent's execution permissions. Otherwise, the skill is internally coherent and does not request secrets or external access.
功能分析
Type: OpenClaw Skill
Name: go
Version: 1.0.2
The skill bundle contains only metadata and documentation files related to Go programming best practices and common pitfalls. There is no executable code, no instructions for the AI agent to perform any actions beyond providing information, no attempts at data exfiltration, persistence, or malicious execution. The content is purely educational and aligns with the stated purpose of helping an agent write reliable Go code.
能力评估
Purpose & Capability
Skill name/description and included docs all describe Go coding guidance. The declared dependency on the go binary is reasonable for a Go helper, but the SKILL.md text itself does not contain runtime steps that invoke the go tool — so the binary requirement is plausible but not strictly used by the provided instructions.
Instruction Scope
SKILL.md and the additional .md files contain static guidance about goroutines, channels, interfaces, errors, collections, and build behaviour. They do not instruct the agent to read arbitrary files, access environment variables, or transmit data to external endpoints.
Install Mechanism
No install spec and no code files are included (instruction-only). Nothing is downloaded or written to disk by the package itself.
Credentials
No environment variables, credentials, or config paths are required. The skill does not request secrets or unrelated service tokens.
Persistence & Privilege
Defaults are used (not always: true). The skill does not request persistent/system-wide changes or elevated privileges in its metadata or instructions.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install go - 安装完成后,直接呼叫该 Skill 的名称或使用
/go触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
Initial release
v1.0.1
Initial release
v1.0.0
Initial release
元数据
常见问题
Go 是什么?
Write reliable Go code avoiding goroutine leaks, interface traps, and common concurrency bugs. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1541 次。
如何安装 Go?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install go」即可一键安装,无需额外配置。
Go 是免费的吗?
是的,Go 完全免费(开源免费),可自由下载、安装和使用。
Go 支持哪些平台?
Go 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。
谁开发了 Go?
由 Iván(@ivangdavila)开发并维护,当前版本 v1.0.2。
推荐 Skills