Skip to content

feat: add Go adapter for lh_standard_adapter - #36

Open
ZacLou wants to merge 1 commit into
UID9622:mainfrom
ZacLou:feat/go-adapter
Open

feat: add Go adapter for lh_standard_adapter#36
ZacLou wants to merge 1 commit into
UID9622:mainfrom
ZacLou:feat/go-adapter

Conversation

@ZacLou

@ZacLou ZacLou commented Aug 27, 2026

Copy link
Copy Markdown

Summary

Implements the Go adapter for lh_standard_adapter as described in #2.

Changes

  • adapters/go/lhstandardadapter/ — full Go implementation (6 source files)
  • adapters/go/lhstandardadapter/adapter_test.go — 44 test cases, all passing
  • adapters/go/go.mod — module definition (github.com/UID9622/lh-standard-adapter)
  • adapters/go/README.md — usage documentation with examples

Implementation Details

  • Zero external dependencies — uses only Go stdlib (crypto/sha256, encoding/hex, encoding/json, regexp, time, fmt, strings)
  • Full port of Python referenceDNAGenerator, AuditWrapper, Validator, Adapter with identical behavior
  • 44 test cases covering DNA generation, audit wrapping, validation, and integration
  • go vet clean
  • GoDoc comments on all exported symbols

API

adapter := lhstandardadapter.NewAdapter("9622", "HM-9622-001")
wrapped, err := adapter.Wrap(data, "code", "P04")
result := adapter.Validate(wrapped)

Acceptance Criteria

  • Module: github.com/UID9622/lh-standard-adapter
  • go get github.com/UID9622/lh-standard-adapter compatible
  • Zero external dependencies (Go stdlib only)
  • Full test suite matching Python test coverage (44 tests, all passing)
  • GoDoc comments on all exported symbols
  • go vet + golint clean
  • README with English + Go usage examples
  • LICENSE: CC-BY-NC-SA 4.0 (inherited from repo)

Cross-Validation

The Go implementation produces identical DNA traceability codes and audit records to the Python reference implementation for the same inputs.

Closes #2

- Pure Go stdlib implementation (zero external dependencies)
- Full port of Python reference: DNAGenerator, AuditWrapper, Validator, Adapter
- 44 test cases all passing
- go vet clean
- Cross-compatible with Python reference implementation
- Resolves UID9622#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🏆 [BOUNTY] Go Adapter — lh_standard_adapter for Go modules

1 participant