Migration: pkg/regexutil → go/regexutil¶
The bounded regex-compilation helper has been extracted out of go-tool-base into
the standalone module gitlab.com/phpboyscout/go/regexutil (v0.1.0). It is
framework-free (only cockroachdb/errors), so any project can adopt it without
pulling in the framework.
What changed¶
- The package
gitlab.com/phpboyscout/go-tool-base/pkg/regexutilno longer exists. It now lives atgitlab.com/phpboyscout/go/regexutil. - The public API is identical. The package name is still
regexutil;CompileBounded,CompileBoundedTimeout,MaxPatternLength,DefaultCompileTimeout, and theErrPattern*sentinels are unchanged. - No GTB adapter and no compatibility shim — a clean pre-1.0 import-path change.
How to migrate¶
-import "gitlab.com/phpboyscout/go-tool-base/pkg/regexutil"
+import "gitlab.com/phpboyscout/go/regexutil"
go get gitlab.com/phpboyscout/go/[email protected]
go mod tidy
A repository-wide substitution is sufficient (package name and symbols unchanged):
grep -rl 'go-tool-base/pkg/regexutil' --include='*.go' . \
| xargs sed -i 's#gitlab.com/phpboyscout/go-tool-base/pkg/regexutil#gitlab.com/phpboyscout/go/regexutil#g'
go mod tidy
Notes¶
- go-tool-base itself now consumes
go/regexutildirectly for its untrusted-pattern compile paths (docs TUI search, Bitbucket release matching). - Full threat model and guidance: regexutil.go.phpboyscout.uk; API reference on pkg.go.dev.