Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 1.79 KB

CONTRIBUTING.md

File metadata and controls

57 lines (43 loc) · 1.79 KB

Contributing to wire

Prerequisites

Go 1.27 or later; the declaration API uses generic methods.

Quick Start

git clone https://github.com/libtnb/wire.git
cd wire
go build ./cmd/wire
go test -race ./...
gofmt -l .
go vet ./...

The suite runs in under a minute. The integration tests build the command and run it against the fixture modules under internal/integration/testdata.

Regenerating fixtures

Fixtures commit their wire_gen.go. After a generator change, regenerate them and review the diff:

go build -o /tmp/wire ./cmd/wire
for fixture in basic advanced scope rollback override_parent resolution unused_export nested_scope struct_binding; do
	(cd internal/integration/testdata/$fixture && /tmp/wire generate .)
done
(cd internal/integration/testdata/modules && /tmp/wire generate ./...)
(cd internal/integration/testdata/private_type_shape && /tmp/wire generate ./...)

Workflow

  1. Branch from main.
  2. Add a fixture or unit test that fails without the change.
  3. Run gofmt -l ., go vet ./..., and go test -race ./....
  4. Add a line to the Unreleased section of CHANGELOG.md for user-visible changes.
  5. Open a pull request.

Guidelines

  • Every package and exported identifier has a doc comment that states intent and constraints, not a paraphrase of the signature.
  • Rejected declarations are reported as WIRE#### diagnostics with a source position; new codes go into docs/diagnostics.md.
  • Generated code stays free of dependencies on this module.
  • Tests exercise behavior through the command or the generated code; there are no test-only hooks in production code.

Reporting Issues

Open a GitHub issue with go version, wire version, the declaration that misbehaves, and the output you expected.