// SortImports sorts runs of consecutive import lines in import blocks in f. // It also removes duplicate imports when it is possible to do so without data loss. func SortImports(fset *token.FileSet, f *File) { … } func lineAt(fset *token.FileSet, pos token.Pos) int { … } func importPath(s Spec) string { … } func importName(s Spec) string { … } func importComment(s Spec) string { … } // collapse indicates whether prev may be removed, leaving only next. func collapse(prev, next Spec) bool { … } type posSpan … type cgPos … func sortSpecs(fset *token.FileSet, f *File, specs []Spec) []Spec { … }