Skip to content

x/tools/cmd/goimports: rewriting imports leaves out stdlib imports with '/' in them #14075

@ScottMansfield

Description

@ScottMansfield

with imports like:

import "bytes"
import "encoding/binary"

and code that adds a dependency on another package, like bufio:

bufio.NewReader(os.Stdin)

goimports will rewrite the imports to look like:

import (
    "bufio"
    "bytes"
)
import "encoding/binary"

The formatting here is odd. I expected it to look like either:

import "bufio"
import "bytes"
import "encoding/binary"

where the established convention in the code of using import before every import is left alone or

import (
    "bufio"
    "bytes"
    "encoding/binary"
)

where the convention of using grouped imports is properly done.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions