Skip to content

cmd/gofmt: inconsistent whitespace after map value type #53001

Open
@dsnet

Description

@dsnet

Consider the following:

var _ = map[string]func() bool{
	"Func": func() bool {
		return false
	},
}

On one line it's go fmt'd as func() bool{ and as func() bool { on the other line. Note the space between bool and {.

In the previous case, this is the syntax for a map literal, while the latter is a function declaration.

Perhaps we should always output a space after a type expression (e.g., func() bool or chan bool) that contains a space?

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions