go

📁 g1joshi/agent-skills 📅 3 days ago
1
总安装量
1
周安装量
#51745
全站排名
安装命令
npx skills add https://github.com/g1joshi/agent-skills --skill go

Agent 安装分布

mcpjam 1
claude-code 1
replit 1
junie 1
zencoder 1

Skill 文档

Go

A simple, fast, and concurrent language developed by Google.

When to Use

  • Microservices / Cloud-native apps
  • Network tools (servers, proxies)
  • High-performance systems
  • CLIs

Quick Start

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")

    ch := make(chan string)
    go func() {
        ch <- "from goroutine"
    }()

    msg := <-ch
    fmt.Println(msg)
}

Core Concepts

Goroutines

Lightweight threads managed by the Go runtime.

go doSomething()

Channels

Typed conduits for communication between goroutines.

Interfaces

Implicitly implemented. If a struct has the methods, it implements the interface.

Best Practices

Do:

  • Handle errors explicitly (check if err != nil)
  • Use gofmt to format code
  • Keep extensive comments for public APIs
  • Use context for cancellation and timeouts

Don’t:

  • Ignore errors (using _) blindly
  • Use panic/recover for normal error handling
  • Create large interfaces (keep them small)

References