Rechercher

PythonReactSEOPDF
GitHub Skill

go-bindings-patterns

Instructions for go bindings patterns.

kreuzberg-dev☆ 560 Étoiles du dépôt50 Forks du dépôt

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

Voir la source ↗Guides

Instructions


priority: high

Go Bindings Patterns

Role: Go bindings for Rust core. Work on CGO bridge and Go SDK/E2E suite.

Scope: Go 1.25 module, CGO wrappers around C FFI, Go-idiomatic config/result structs, linting setup, benchmark harness scripts.

Commands: cd packages/go/v4 && go test ./..., golangci-lint run ./..., ensure LD_LIBRARY_PATH/DYLD_LIBRARY_PATH includes target/release when running tests.

FFI: Binding header (packages/go/v4/binding.go) must stay in sync with C FFI header. Add new APIs to Rust first, then expose through CGO, update types.go, regenerate Go E2E tests when fixtures change.

Critical: Core logic lives in Rust. Go code should remain thin wrappers/helper utilities over C API. Coordinate with Rust team for shared logic.

Go 1.25+ Standards

  • Go 1.25+; error wrapping with fmt.Errorf("%w", err), errors.Is/As for checking
  • Testing: *_test.go with _test package suffix (black-box), table-driven with t.Run()
  • golangci-lint: errcheck, govet, staticcheck, gosec, gocyclo (complexity <=25)
  • Coverage 80%+ on business logic; go test -race for concurrency bugs
  • Package structure: cmd/, internal/ (no cross-service imports), pkg/ for libraries
  • Naming: PascalCase (types), camelCase (vars), SCREAMING_SNAKE_CASE (consts)
  • Context.Context first param in I/O funcs; respect cancellation with select <-ctx.Done()
  • Structured logging: zerolog with Str/Int/Err chaining
  • Never: bare error returns, cross-service internal imports, panic in libraries

Exemples

Consultez les exemples du dépôt source.

Voir la source ↗

Historique source

Date d’indexation
2026-03-11
Mise à jour de l’index
2026-03-11
Branch
main

Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!