Skip to content

Migration: pkg/redactgo/redact

The credential-redaction helper has been extracted out of go-tool-base into the standalone module gitlab.com/phpboyscout/go/redact (v0.1.0). It is zero-dependency (pure standard library), so any project can adopt it without pulling in the framework.

What changed

  • The package gitlab.com/phpboyscout/go-tool-base/pkg/redact no longer exists. It now lives at gitlab.com/phpboyscout/go/redact.
  • The public API is identical. The package name is still redact; String, Error, SensitiveHeaderKeys, and IsSensitiveHeaderKey are unchanged.
  • There is no GTB adapter and no compatibility shim — a clean pre-1.0 import-path change.

How to migrate

Repoint the import path — nothing else changes:

-import "gitlab.com/phpboyscout/go-tool-base/pkg/redact"
+import "gitlab.com/phpboyscout/go/redact"

Then add the module and tidy:

go get gitlab.com/phpboyscout/go/[email protected]
go mod tidy

A repository-wide substitution is sufficient (the package name and every symbol are unchanged):

grep -rl 'go-tool-base/pkg/redact' --include='*.go' . \
  | xargs sed -i 's#gitlab.com/phpboyscout/go-tool-base/pkg/redact#gitlab.com/phpboyscout/go/redact#g'
go mod tidy

Notes

  • go-tool-base itself now consumes go/redact directly; it remains GTB's single entry point for untrusted-string redaction (telemetry, HTTP middleware, doctor diagnostics).
  • Full documentation and the threat model live at redact.go.phpboyscout.uk; the API reference is on pkg.go.dev.