goimports Command Examples

Updates Go import lines, adding missing ones and removing unreferenced ones. More information: https://godoc.org/golang.org/x/tools/cmd/goimports.

goimports {{path/to/file.go}}

goimports -w {{path/to/file.go}}

goimports -w -d {{path/to/file.go}}

goimports -local {{path/to/package1,path/to/package2,...}} {{path/to/file.go}}