Language

Provides Go idioms, style guides, and best practices for writing idiomatic code.

51|6|Updated Mar 28, 2019
One-click install
npx skills add https://github.com/Mte90/dotfiles --skill language-mte90
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Language
Source: https://github.com/Mte90/dotfiles/tree/main/.config/opencode/skills/golang/language
Command: npx skills add https://github.com/Mte90/dotfiles --skill language-mte90

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides essential guidelines and best practices for writing clean, efficient, and idiomatic Go code, helping developers adhere to community standards and avoid common pitfalls.

Core Features & Use Cases

  • Coding Standards: Enforces naming conventions, package structure, and error handling.
  • Best Practices: Guides on interface design, variable usage, and slice manipulation.
  • Anti-Patterns: Highlights common mistakes to avoid, such as unnecessary global variables or improper error handling.
  • Use Case: A new developer joins a Go project and needs to understand the team's coding style. They can consult this Skill for immediate guidance on how to structure their code, name variables, and handle errors according to established Go idioms.

Quick Start

Follow the Golang language standards for writing idiomatic Go code.

Frequently Asked Questions about Language

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the best practices for writing idiomatic Go code?

Idiomatic Go code best practices involve enforcing formatting with gofmt, following naming conventions like camelCase, designing efficient interfaces, and handling errors properly to avoid common pitfalls like global mutable state and panic for control flow.

How do I handle errors in Go without using anti-patterns?

Handle errors in Go by checking them directly rather than ignoring them or using panic for control flow. Idiomatic Go avoids anti-patterns like global mutable state and improper error handling by returning errors explicitly from functions.

What naming conventions should I use for Go packages and variables?

Use camelCase or PascalCase for variable naming in Go, and follow specific package naming rules to avoid stuttering method names. Adhering to these coding standards ensures clean, community-approved idiomatic Go code.

Why should I avoid using init() and global mutable state in Golang?

Avoid using init() and global mutable state in Golang because they are considered anti-patterns that introduce hidden dependencies and complicate testing. Idiomatic Go promotes explicit variable scoping and dependency injection over global state.

Does this Go style guide reference effective go and idiomatic patterns?

Yes, this Go style guide references idioms.md and effective-go-summary.md to provide detailed explanations of core idioms, interface design principles, and slice manipulation techniques for writing idiomatic Go code.