autogenpb/newsort.go

27 lines
502 B
Go
Raw Normal View History

package main
import (
"os"
)
2025-01-09 15:51:45 -06:00
func (pb *Files) makeNewSortfile(pf *File) error {
f, _ := os.OpenFile(pf.Filebase+".newsort.pb.go", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
header(f, pf)
2025-01-09 15:29:27 -06:00
pf.syncLock(f)
if argv.Mutex {
// use the mutex lock from the modified protoc.pb.go file
pf.Bases.Lockname = "all.Lock"
2025-01-09 15:29:27 -06:00
}
2025-01-09 15:51:45 -06:00
pf.Base.iterTop(f)
pf.Base.iterNext(f)
pf.iterSelect(f)
2025-01-09 16:18:06 -06:00
pf.appendUnique(f) // Append() enforce no unique keys
pf.iterSortBy(f)
pf.iterAll(f)
2025-01-09 21:15:01 -06:00
pf.iterDelete(f)
2025-01-09 15:51:45 -06:00
return nil
}