Comments on package declarations should provide general package documentation. These comments can be short, like the sort
package’s brief description:
// Package sort provides primitives for sorting slices and user-defined
// collections.
package sort
With goimports, you can automatically update your Go import lines (add missing and remove unreferenced imports).
In addition to fixing imports, goimports also formats your code in the same style as gofmt so it can be used as a replacement for your editor’s gofmt-on-save hook.
gofmt
which additionally adds (and removes) import lines as necessary.Gofmt is a tool that automatically formats Go source code.
Gofmt’d code is: