chore(lint): apierror AsType + accesscontrol godoc/any#68
Merged
Conversation
…GroupMemberRoleInput godoc
Three small staticcheck cleanups requested by reviewers:
apierror/apierror.go (errors.AsType simplification, Go 1.26+)
IsAPIError / FromError were doing the boilerplate
var apiErr *Error
errors.As(err, &apiErr)
Switched to the generic helper available since 1.26:
_, ok := errors.AsType[*Error](err)
apiErr, ok := errors.AsType[*Error](err)
Same semantics, fewer lines, no extra allocation.
accesscontrol/group.go
- Added package doc comment (S1000 / ST1000 — at least one file
per package must carry a package doc).
- UpdateGroupMemberRoleInput godoc subject corrected from
"UpdateMemberRoleInput" (the now-renamed type) to match the
actual symbol name. ST1020.
accesscontrol/group_sync.go
- map[string]interface{} → map[string]any. Drive-by ST1019.
No behavior change. Build + staticcheck clean on both touched packages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apierror.IsAPIError/FromErroruseerrors.AsType[*Error](Go 1.26+) instead oferrors.As(err, &apiErr)boilerplateinternal/app/accesscontrol: add package doc comment (ST1000)UpdateGroupMemberRoleInputgodoc subject matches the type name (ST1020)group_sync.go:map[string]interface{}→map[string]any(ST1019)All three were flagged by staticcheck on PR review. No behavior change.
Test plan
go build ./...staticcheck ./pkg/apierror/... ./internal/app/accesscontrol/...clean