Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/cmd/goimports: rewriting imports leaves out stdlib imports with '/' in them #14075
with imports like:
and code that adds a dependency on another package, like bufio:
goimports will rewrite the imports to look like:
The formatting here is odd. I expected it to look like either:
where the established convention in the code of using
where the convention of using grouped imports is properly done.
The behavior here is unrelated to the '/' character in "encoding/binary"; e.g., I can repro the issue with "os" instead of "encoding/binary".
goimports is just adding all of the new imports to the first import declaration in the file, and leaving other existing imports separate. Arguably this is working as documented. /cc @bradfitz