mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 14:59:58 +00:00
TUN-8006: Update quic-go to latest upstream
This commit is contained in:
28
vendor/golang.org/x/tools/internal/imports/fix.go
generated
vendored
28
vendor/golang.org/x/tools/internal/imports/fix.go
generated
vendored
@@ -414,9 +414,16 @@ func (p *pass) fix() ([]*ImportFix, bool) {
|
||||
})
|
||||
}
|
||||
}
|
||||
// Collecting fixes involved map iteration, so sort for stability. See
|
||||
// golang/go#59976.
|
||||
sortFixes(fixes)
|
||||
|
||||
// collect selected fixes in a separate slice, so that it can be sorted
|
||||
// separately. Note that these fixes must occur after fixes to existing
|
||||
// imports. TODO(rfindley): figure out why.
|
||||
var selectedFixes []*ImportFix
|
||||
for _, imp := range selected {
|
||||
fixes = append(fixes, &ImportFix{
|
||||
selectedFixes = append(selectedFixes, &ImportFix{
|
||||
StmtInfo: ImportInfo{
|
||||
Name: p.importSpecName(imp),
|
||||
ImportPath: imp.ImportPath,
|
||||
@@ -425,8 +432,25 @@ func (p *pass) fix() ([]*ImportFix, bool) {
|
||||
FixType: AddImport,
|
||||
})
|
||||
}
|
||||
sortFixes(selectedFixes)
|
||||
|
||||
return fixes, true
|
||||
return append(fixes, selectedFixes...), true
|
||||
}
|
||||
|
||||
func sortFixes(fixes []*ImportFix) {
|
||||
sort.Slice(fixes, func(i, j int) bool {
|
||||
fi, fj := fixes[i], fixes[j]
|
||||
if fi.StmtInfo.ImportPath != fj.StmtInfo.ImportPath {
|
||||
return fi.StmtInfo.ImportPath < fj.StmtInfo.ImportPath
|
||||
}
|
||||
if fi.StmtInfo.Name != fj.StmtInfo.Name {
|
||||
return fi.StmtInfo.Name < fj.StmtInfo.Name
|
||||
}
|
||||
if fi.IdentName != fj.IdentName {
|
||||
return fi.IdentName < fj.IdentName
|
||||
}
|
||||
return fi.FixType < fj.FixType
|
||||
})
|
||||
}
|
||||
|
||||
// importSpecName gets the import name of imp in the import spec.
|
||||
|
Reference in New Issue
Block a user