зеркало из https://github.com/golang/pkgsite.git
internal/frontend: sort source files
Display the source files in sorted order. This makes them consistent, which is nice for UX but even more important for page diffing. Change-Id: If6634d51c3ff405e78c287ce59f60621179fa4cc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/266277 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Родитель
2c6a27eca9
Коммит
5142799a31
|
@ -8,6 +8,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -96,6 +97,7 @@ func sourceFiles(u *internal.Unit, docPkg *godoc.Package) []*File {
|
|||
URL: u.SourceInfo.FileURL(path.Join(internal.Suffix(u.Path, u.ModulePath), f.Name)),
|
||||
})
|
||||
}
|
||||
sort.Slice(files, func(i, j int) bool { return files[i].Name < files[j].Name })
|
||||
return files
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче