Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Revisit Go imports #1485

Open
1 task done
SaschaSchwarze0 opened this issue Feb 5, 2024 · 3 comments
Open
1 task done

[FEATURE] Revisit Go imports #1485

SaschaSchwarze0 opened this issue Feb 5, 2024 · 3 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@SaschaSchwarze0
Copy link
Member

Is there an existing feature request for this?

  • I have searched the existing feature requests

Is your feature request related to a problem or use-case? Please describe.

The imports we go in our Go sources are not consistent and not ideal for code reviews.

In particular, when reviewing a PR like this, it would be helpful if import changes come without alias changes.

Describe the solution that you would like.

In the community meeting, we concluded that we will use names like buildapi or pipelineapi going forward for API imports to make them independent of the imported version. Exceptions would still be allowed when we import more than one version (like we do in triggers for Tekton as we need v1 to work with Pipelines but also v1beta1 for Runs).

In addition, Matthias suggested to evaluate if a tool exists that verifies that imports are as expected, and can maybe autofix this.

Describe alternatives you have considered.

No response

Anything else?

No response

@SaschaSchwarze0 SaschaSchwarze0 added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 5, 2024
@HeavyWombat
Copy link
Contributor

We can consider to use goimports if its features would be helpful for our ideas. Need to verify the feature set first.

@SaschaSchwarze0
Copy link
Member Author

We can consider to use goimports if its features would be helpful for our ideas. Need to verify the feature set first.

Checked the tool. It can do things like reordering imports but I found no way to rename imports in the way we want it.

@adambkaplan
Copy link
Member

From refinement - adding to backlog as having a community standard on import ordering would be beneficial.

Enforcing a standard on import namings is a lot more challenging - per @SaschaSchwarze0 no tooling exists yet to enforce a pattern. goimports can at least enforce standards on import ordering, and we can enable it with golangci-lint.

@adambkaplan adambkaplan added this to the Backlog milestone Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
Status: No status
Development

No branches or pull requests

3 participants