Skip to content

Conversation

@atombrella
Copy link

@atombrella atombrella commented Oct 11, 2025

Description

For the sake of curiosity, since there was no .golangci-lint.yaml file in the project, I experimented with a simple configuration file locally, and have found a bunch of issues. Sorting the imports according to goimports is good practice, so stdlib golang libraries are in the top, and then dependencies from external sources below that.

Note that the command has also fixed formatting of fields in structs, which is another Golang best practice.
If it is of interest, I can volunteer to fix some of the other ones, and introduce a proper linting configuration.

The command also added lines in the top of files, e.g., //go:build linux || darwin whenever there was a // +build linux (or darwin). I just let it be.

I have used:

for gofile in **/*.go
do
	goimports -w $gofile
done

VSCode with Golang configuration automatically sorts the imports when you save the file.

Type of Change

  • Bug fix
  • New feature
  • Documentation update required
  • Code quality improvement
  • Other (describe):

How Has This Been Tested?

Just with compilation. Logic shouldn't be affected by reformatting.

Thank you for your contribution to AzCopy!

Done with

for gofile in **/*.go
do
	goimports -w $gofile
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant