You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor!: rename error vars to ErrFoo and expand lint enforcement (#11)
* refactor!: rename exported error vars from FooError to ErrFoo
BREAKING CHANGE: every exported error identifier changes name to match
the staticcheck ST1012 convention that the Go standard library uses.
Consumers referencing these variables must update their imports:
NoBaseURLError -> ErrNoBaseURL
UnexpectedEmptyStringError -> ErrUnexpectedEmptyString
NonEmptySuffixError -> ErrNonEmptySuffix
BadParserIndexError -> ErrBadParserIndex
DuplicatePartNameError -> ErrDuplicatePartName
RequiredTokenError -> ErrRequiredToken
InvalidIPv6HostnameError -> ErrInvalidIPv6Hostname
InvalidPortError -> ErrInvalidPort
EmptyPartNameError -> ErrEmptyPartName
InvalidModifierError -> ErrInvalidModifier
InvalidPrefixOrSuffix -> ErrInvalidPrefixOrSuffix
InvalidPartNameError -> ErrInvalidPartName
TypeError -> ErrType
Also drops the ST1012 exclusion from .golangci.yml since the codebase
now satisfies it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: address remaining golangci-lint findings and enforce them
Expand the enabled linter set in .golangci.yml (err113, goconst,
gocritic, intrange, modernize, perfsprint, thelper, unconvert, unparam,
wastedassign, whitespace) and address every new finding:
- wastedassign: collapse ExecInit's 8 dead var = "" initializations and
one in parser.go where regexpValue was assigned and immediately
reassigned.
- gocritic (assignOp / ifElseChain / typeSwitchVar): use x += y, rewrite
if-else chains to switch, switch on typed values.
- intrange: for range b.N in benchmarks, for i := range len(portValue)
in the port prefix check; keep escape.go as-is (i needed after loop)
with a //nolint rationale.
- modernize: replace interface{} with any in tests, use slices.Contains.
- perfsprint: fmt.Sprintf("%d", i) -> strconv.Itoa(i) in test names.
- unconvert: drop redundant int() around p.componentStart.
- unparam: consumeRequiredToken no longer returns its *token since
every caller discarded it.
- whitespace: trim a stray trailing newline in buildExpected and a
leading one in newExpectedResult.
- err113: hoist "invalid hostname" to errInvalidHostname at package
level, add two test-only sentinels for the WPT harness.
- goconst: extract "pattern"/"url" into initTypePattern / initTypeURL.
- thelper: t.Helper() in the three WPT test helpers.
- Drop the dead commented //p.result.Hash/Search lines in the
constructor parser and refactor the surrounding if/else into a switch.
All 365 WPT cases + the regression tests still pass; golangci-lint
reports 0 issues with the widened configuration.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments