diff --git a/go/packages/visit.go b/go/packages/visit.go index a50eb3b5..b13cb081 100644 --- a/go/packages/visit.go +++ b/go/packages/visit.go @@ -3,6 +3,7 @@ package packages import ( "fmt" "os" + "sort" ) // Visit visits all the packages in the import graph whose roots are @@ -23,6 +24,7 @@ func Visit(pkgs []*Package, pre func(*Package) bool, post func(*Package)) { for path := range pkg.Imports { paths = append(paths, path) } + sort.Strings(paths) // Imports is a map, this makes visit stable for _, path := range paths { visit(pkg.Imports[path]) }