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

goimports and local package #1348

Closed
cyriltovena opened this issue Dec 2, 2019 · 11 comments · Fixed by #1710
Closed

goimports and local package #1348

cyriltovena opened this issue Dec 2, 2019 · 11 comments · Fixed by #1710

Comments

@cyriltovena
Copy link
Contributor

As per the discussions on the PR : #1249 (comment)

It seems that we want to order local package as last together.

golangci-lint seems to support this.

 goimports:
    # put imports beginning with prefix after 3rd-party packages;
    # it's a comma-separated list of prefixes
    local-prefixes: github.com/org/project

Do we all agree that we want this ? /cc @pstibrany @rfratto @sh0rez @slim-bean @joe-elliott @pracucci @gouthamve @owen-d (AKA are you able to configure your IDE accordingly ?)

@rfratto
Copy link
Member

rfratto commented Dec 2, 2019

I'm indifferent about this, but I can confirm that vim-go users (like me) can get it working in vim.

@rfratto
Copy link
Member

rfratto commented Dec 2, 2019

I'm worried that third party contributors are going to struggle with this, though.

@pstibrany
Copy link
Member

I'm indifferent about this, but I can confirm that vim-go users (like me) can get it working in vim.

Default goimports settings are fine for me. It’s easy to setup in GoLand, but it’s one extra project-specific setting. So small -1 from me, but I don’t care too much if we decide otherwise.

I'm worried that third party contributors are going to struggle with this, though.

It’s just one more lint check to deal with.

@pracucci
Copy link
Contributor

pracucci commented Dec 4, 2019

I'm not sure it's doable in VSCode. Is there anyone else who is using it, which has figure out how to do it?

@cyriltovena
Copy link
Contributor Author

I'm not sure it's doable in VSCode. Is there anyone else who is using it, which has figure out how to do it?

Vscode should listen to the golangci-lint config

@pracucci
Copy link
Contributor

pracucci commented Dec 4, 2019

Vscode should listen to the golangci-lint config

Looks correct:

Golangci-lint automatically discovers .golangci.yml config for edited file: you don't need to configure it in VS Code settings.

@sh0rez
Copy link
Member

sh0rez commented Dec 4, 2019

Regarding this, goimports acts actually quite weird:

If you invoke it without -local, it sorts imports only. BUT if you group locals by hand it respects that and keeps them grouped.

If you invoke it with -local, it groups them for you. Personally, I did not teach my editor to be aware of -local. I manage it myself one time, goimports picks it up then for me. Once in a while I run it with -local on the CLI to see if I missed something

@stale
Copy link

stale bot commented Jan 11, 2020

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Jan 11, 2020
@stale stale bot closed this as completed Jan 18, 2020
@sh0rez
Copy link
Member

sh0rez commented Jan 19, 2020

@cyriltovena @rfratto @slim-bean what's the state on this? I'd still prefer this style, I guess we should at least decide on something

@cyriltovena
Copy link
Contributor Author

cyriltovena commented Jan 22, 2020

Send a pr if you don’t want to wait, this low priority for me. I also like it.

@sh0rez sh0rez reopened this Jan 22, 2020
@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Jan 22, 2020
@owen-d
Copy link
Member

owen-d commented Feb 11, 2020

I think I got hit by this in cortex today 😱. AFAICT we have to set the prefix per project. It's not too bad and I like the style. I guess I'll have to figure out how to set this up automatically.

cyriltovena pushed a commit to cyriltovena/loki that referenced this issue Jun 11, 2021
Refactor: do table names in just one place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants