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

x/tools/gopls: wire up gofumpt option fields with information from the main module #51327

Closed
mvdan opened this issue Feb 22, 2022 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented Feb 22, 2022

From internal/hooks/hooks.go, as per https://go-review.googlesource.com/c/tools/+/387374:

    options.GofumptFormat = func(ctx context.Context, src []byte) ([]byte, error) {
        return format.Source(src, format.Options{
            // TODO: fill LangVersion and ModulePath from the current go.mod.
            // The information is availabe as loaded by go/packages via the
            // Module type, but it needs to be wired up all the way here.
            // We likely want to change the GofumptFormat field type to take
            // extra parameters, to then be used in format.Options.
            // See https://pkg.go.dev/mvdan.cc/gofumpt@v0.3.0/format#Options.
        })
    }

This is a tracking issue so we remember to do this hopefully sooner than later. It's not rocket science; we just need to figure out the right way to wire up the information across the involved interfaces and APIs.

Since GitHub doesn't linkify inside blockquotes, by the way: https://pkg.go.dev/mvdan.cc/gofumpt@v0.3.0/format#Options

cc @findleyr

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Feb 22, 2022
@gopherbot gopherbot added this to the Unreleased milestone Feb 22, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.8.1 Feb 23, 2022
@gopherbot
Copy link

Change https://go.dev/cl/387634 mentions this issue: gopls: wire in LangVersion and ModulePath for gofumpt formatting

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants