all: deduplicate same-package imports (staticcheck ST1019)#3695
Open
Deln0r wants to merge 1 commit into
Open
Conversation
A handful of files imported the same package twice, once plain and once aliased. staticcheck ST1019 flags this because the two names refer to the same package and add no information; one of them is redundant. For each file the dominant name in the body wins and the other import is removed, with the affected references renamed to match: - clientapi/routing/admin.go: collapse `api`/`userapi` for userapi/api → `userapi` (matches the repo-wide convention). - cmd/dendrite-demo-yggdrasil/yggconn/node.go: collapse `yggdrasilcore`/`core` and `yggdrasilmulticast`/`multicast` → the plain names. No collisions with other imports in the file. - federationapi/consumers/roomserver.go: collapse `logrus`/`log` → `log`. - federationapi/routing/routing.go: collapse `api`/`roomserverAPI` for roomserver/api → `roomserverAPI`. - roomserver/internal/perform/perform_join.go: collapse `api`/`rsAPI` for roomserver/api → `rsAPI`. - roomserver/internal/perform/perform_leave.go: collapse `api`/`rsAPI` for roomserver/api → `api` (the dominant name in this file). - syncapi/consumers/clientapi.go: collapse `logrus`/`log` → `logrus`. - syncapi/consumers/roomserver.go: collapse `logrus`/`log` → `log`. No behavior change; only import aliases and the corresponding qualifier on call sites move. Signed-off-by: Ian Chechin <ian00chechin@gmail.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
A handful of files imported the same package twice, once plain and once aliased. staticcheck
ST1019flags this because the two names refer to the same package and add no information; one of them is redundant.For each file the dominant name in the body wins and the other import is removed, with the affected references renamed to match.
clientapi/routing/admin.goapi+userapiforuserapi/apiuserapi(matches repo-wide convention, ~73 files vs ~10)cmd/dendrite-demo-yggdrasil/yggconn/node.goyggdrasilcore+ plaincore;yggdrasilmulticast+ plainmulticastfederationapi/consumers/roomserver.gologrus+loglog(12 uses vs 2)federationapi/routing/routing.goapi+roomserverAPIforroomserver/apiroomserverAPI(17 vs 3)roomserver/internal/perform/perform_join.goapi+rsAPIforroomserver/apirsAPI(23 vs 1)roomserver/internal/perform/perform_leave.goapi+rsAPIforroomserver/apiapi(18 vs 2)syncapi/consumers/clientapi.gologrus+loglogrus(7 vs 6, matches repo majority)syncapi/consumers/roomserver.gologrus+loglog(32 vs 4)The kept name was chosen per-file to minimize the number of touched call sites; happy to flip any of them if there's a project-wide convention I missed.
No behavior change; only import aliases and the corresponding qualifier on call sites move.
Test plan
go build ./...clean