FFFF [go] goimport that check and replace specific import · Issue #118 · dyweb/gommon · GitHub
[go: up one dir, main page]

Skip to content

[go] goimport that check and replace specific import #118

Open

Description

@at15

Now I use goimport instead of gofmt when formatting code because it checks import and do the sorting. However I have some new use cases:

  • replace specific import because they were added by IDE when there are imports with similar name. Especially when your dependency depends on its own fork of your other dependency, e.g. assert.
  • group import into multiple groups, e.g. protobuf, third party dependency, packages inside the project
  • enforce import alias, e.g. protobuf packages should be named to xxxpb

Should put it under gommon fmt or gommon gofmt

Activity

  1. added this to the future milestone on Jan 1, 2020
  2. self-assigned this
    on Jan 1, 2020
  3. at15 commented on Feb 28, 2020

    @at15
    MemberAuthor

    I should be part of #75

  4. at15 commented on Feb 29, 2020

    @at15
    MemberAuthor
  5. at15 commented on Mar 6, 2020

    @at15
    MemberAuthor

    Also there is one checking if specific import is allowed https://github.com/fatih/faillint

  6. at15 commented on Mar 8, 2020

    @at15
    MemberAuthor
  7. at15 commented on Mar 8, 2020

    @at15
    MemberAuthor

    https://pkg.go.dev/golang.org/x/tools/go/ast/astutil?tab=doc#AddImport astutil contains add and remove imports, looks pretty good ... not sure if we can do something similar to goimports using that

  8. modified the milestones: future, 0.0.15 on Mar 8, 2020
  9. at15 commented on Mar 8, 2020

    @at15
    MemberAuthor
  10. at15 commented on Mar 9, 2020

    @at15
    MemberAuthor
  11. added a commit that references this issue on Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0