8000 receptor/STANDARDS.md at devel · ansible/receptor · GitHub
[go: up one dir, main page]

Skip to content
8000

Latest commit

 

History

History
9 lines (7 loc) · 845 Bytes

STANDARDS.md

File metadata and controls

9 lines (7 loc) · 845 Bytes

Go Standards

Receptor expects idiomatic Go. This file records only the project-specific rules that are easy to miss.

  • Interfaces are small and consumer-owned. Define an interface next to the code that uses it and expose only the methods that consumer needs. Accept interfaces, return concrete types.
  • Prefer config structs over long parameter lists. Pass a struct for related parameters instead of many positional arguments.
  • Mocks use go.uber.org/mock. Generate them from interfaces with make generate; never edit generated mock files by hand.
  • New imports must be added to the matching depguard allowlist in .golangci.yml: main for production code, tests for test and functional code.
  • Before opening a PR: make build-all, make test, and make lint pass, and new behavior or bug fixes have tests.
0