Skip to content

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

@mvdan

Description

@mvdan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions