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

fix(go): install missing goimports #1166

Merged
merged 1 commit into from
Aug 19, 2024
Merged

fix(go): install missing goimports #1166

merged 1 commit into from
Aug 19, 2024

Conversation

mehalter
Copy link
Member

📑 Description

This supersedes #1162. gopls uses gofumpt for formatting so we can leverage that after running goimports

ℹ Additional Information

Copy link

github-actions bot commented Aug 19, 2024

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

  • If you are adding a new plugin, the scope would be the name of the category it is being added into. ex. feat(utility): added noice.nvim plugin

  • If you are modifying a pre-existing plugin or pack, the scope would be the name of the plugin folder. ex. fix(noice-nvim): fix LSP handler error

  • Pull request title has the appropriate conventional commit type and scope where the scope is the name of the pre-existing directory in the project as described above

  • README is properly formatted and uses fenced in links with <url> unless they are inside a [title](url)

  • Entry returns a single plugin spec with the new plugin as the only top level spec (not applicable for recipes or packs).

  • Proper usage of opts table rather than setting things up with the config function.

  • Proper usage of specs table for all specs that are not dependencies of a given plugin (not applicable for recipes or packs).

@mehalter mehalter requested a review from a team August 19, 2024 13:14
@Uzaaft
Copy link
Member

Uzaaft commented Aug 19, 2024

Fixes mistake done in #1059 I think?

@mehalter
Copy link
Member Author

Yup!

@mehalter mehalter merged commit 50ad0af into main Aug 19, 2024
16 checks passed
@mehalter mehalter deleted the go_fix_missing_install branch August 19, 2024 14:36
@pgr0ss
Copy link
Contributor

pgr0ss commented Aug 19, 2024

Don't you still need to install gofumpt via mason-tool-installer? In my local testing, it didn't run gofumpt until I added this:

  {
    "WhoIsSethDaniel/mason-tool-installer.nvim",
    opts = function(_, opts)
      opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "gofumpt" })
    end,
  },

@mehalter
Copy link
Member Author

It doesn't need to, it uses gopls for formatting since that has gofumpt built in

@mehalter
Copy link
Member Author

@pgr0ss
Copy link
Contributor

pgr0ss commented Aug 19, 2024

Hmm, I'm not sure why mine didn't work until I installed it, then. I will look into it. Thanks.

@mehalter
Copy link
Member Author

I can take a look in a bit, but gopls should be formatting after goimports 😅

@mehalter
Copy link
Member Author

Just tested @pgr0ss and it works great! no gofumpt necessary :D gopls handles the formatting itself

@pgr0ss
Copy link
Contributor

pgr0ss commented Aug 19, 2024

@mehalter Do we need to add gofumpt = true to the gopls config, then? This says the default is false:

https://github.com/golang/tools/blob/master/gopls/doc/settings.md#gofumpt-bool

When I added gofumpt = true here it started working for me:

gopls = {
analyses = {
ST1003 = true,
fieldalignment = false,
fillreturns = true,
nilness = true,
nonewvars = true,
shadow = true,
undeclaredname = true,
unreachable = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
codelenses = {
gc_details = true, -- Show a code lens toggling the display of gc's choices.
generate = true, -- show the `go generate` lens.
regenerate_cgo = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
buildFlags = { "-tags", "integration" },
completeUnimported = true,
diagnosticsDelay = "500ms",
matcher = "Fuzzy",
semanticTokens = true,
staticcheck = true,
symbolMatcher = "fuzzy",
usePlaceholders = true,
},

@mehalter
Copy link
Member Author

oh yeah maybe! I see, without it it's just running go fmt. Yup that would be a great addition. One second and I'll add it

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 this pull request may close these issues.

3 participants