Implement
Foundation for any code change in shiroclient-sdk-go. Covers the full edit-lint-build-test loop.
Workflow
1. Ensure Plugin is Available
The mock client tests require the substrate plugin binary. Before running any tests:
make plugin
This downloads platform-specific binaries to build/. Skip if already present.
2. Make Your Changes
Follow these conventions:
- Public API: Expose via type aliases in
shiroclient/package (seeshiroclient/shiroclient.go) - Internal logic: Lives in
internal/types/,internal/rpc/, orinternal/mock/ - Configuration: Add new options as
Configbuilders inshiroclient/configs.go - New sub-packages: Follow the pattern of
shiroclient/batch/,shiroclient/private/, etc. - Deprecated APIs: Suppress staticcheck with
//nolint:staticcheckwhere backward compat requires it (e.g.,github.com/golang/protobuf/jsonpb)
3. Write or Update Tests
- Embed LISP phylum code via
//go:embed *_test.lispdirectives - Use
testify(require/assert) for assertions - Mock client setup pattern:
client, err := shiroclient.NewMock(nil) require.NoError(t, err) t.Cleanup(client.Close()) - Use snapshot/restore for ledger state tests:
client.Snapshot(writer)/mock.WithSnapshotReader(reader)
4. Lint
golangci-lint run ./...
This matches CI (golangci-lint v1.63, default config). Fix any issues before proceeding.
5. Run Tests
Scoped test (recommended during development):
go test -timeout 10m -run TestName ./shiroclient/...
Full suite:
make test
6. Verify Build
go build ./...
Ensures all packages compile cleanly.
Key Reminders
- Tests WILL FAIL without the substrate plugin. Run
make pluginfirst. - The
SUBSTRATEHCP_FILEenv var is set automatically by the Makefile to point to the platform binary. - If you add a new
.lisptest file, ensure the//go:embeddirective in the corresponding_test.gofile picks it up. - No
.golangci.ymlexists; linting uses golangci-lint defaults. - Go version is 1.23 (see
go.mod).
Checklist
- Plugin binary exists (
make plugin) -
golangci-lint run ./...passes -
go build ./...compiles cleanly -
make testpasses - New/changed behavior has test coverage
Converted and distributed by TomeVault — claim your Tome and manage your conversions.