amalgomate/imports.go
func importBreakPaths(file *ast.File) []string {
	var output []string

	for _, decl := range file.Decls {
		if gen, ok := decl.(*ast.GenDecl); ok && gen.Tok == token.IMPORT {
			for srcIndex, currSpec := range gen.Specs {
				if srcIndex > 0 {
					// if there was a previous element, check if the group has changed
					currGroup := importGroup(importPath(currSpec))
					prevGroup := importGroup(importPath(gen.Specs[srcIndex-1]))
					if currGroup != prevGroup {
						// if group has changed, add path to the output
						output = append(output, importPath(gen.Specs[srcIndex]))
					}
				}
			}

			// assume that only one import token block exists
			break
		}
	}

	return output
}
func importBreakPaths(file *ast.File) []string {
	var output []string

	for _, decl := range file.Decls {
		if gen, ok := decl.(*ast.GenDecl); ok && gen.Tok == token.IMPORT {
			for srcIndex, currSpec := range gen.Specs {
				if srcIndex > 0 {
					// if there was a previous element, check if the group has changed
					currGroup := importGroup(importPath(currSpec))
					prevGroup := importGroup(importPath(gen.Specs[srcIndex-1]))
					if currGroup != prevGroup {
						// if group has changed, add path to the output
						output = append(output, importPath(gen.Specs[srcIndex]))
					}
				}
			}

			// assume that only one import token block exists
			break
		}
	}

	return output
}
// importBreakPaths returns a slice that contains the import paths before which a line breaks should be inserted.