chore(lint): enable modernize linter and apply suggested refactorings - #387
Open
dongjiang1989 wants to merge 1 commit into
Open
chore(lint): enable modernize linter and apply suggested refactorings#387dongjiang1989 wants to merge 1 commit into
dongjiang1989 wants to merge 1 commit into
Conversation
Signed-off-by: dongjiang <dongjiang1989@126.com>
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
Enable the
modernizelinter in.golangci.ymland apply the refactorings it suggests across the codebase.Changes
.golangci.yml: enablemodernizein the linter list; also fix missing trailing newline.a2acompat/a2av0/migration.go: replace manual map copy loop withmaps.Collect.a2acompat/a2av0/rest_compat_test.go: replacestrings.HasPrefix+strings.TrimPrefixpair withstrings.CutPrefix.a2asrv/eventqueue/manager_in_memory_impl_test.goanda2asrv/push/store_test.go: replacefor i := 0; i < n; i++withfor i := range n.a2asrv/taskstore/inmemory.goanda2asrv/taskstore/store_test.go: replace[]byte(fmt.Sprintf(...))withfmt.Appendf(nil, ...).Verification
go vet ./...— cleangolangci-lint run ./...— 0 issuesgo test -count=1 ./...— all 29 packages pass