| // Copyright 2015 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Sortac sorts the AUTHORS and CONTRIBUTORS files. |
| // Sortac sorts the named files in place. |
| // If given no arguments, it sorts standard input to standard output. |
| "golang.org/x/text/collate" |
| "golang.org/x/text/language" |
| log.SetPrefix("sortac: ") |
| os.Stdout.Write(sortAC(os.Stdin)) |
| for _, arg := range args { |
| if err := ioutil.WriteFile(arg, sorted, 0644); err != nil { |
| func sortAC(r io.Reader) []byte { |
| bs := bufio.NewScanner(r) |
| if t == "# Please keep the list sorted." { |
| if err := bs.Err(); err != nil { |
| c := collate.New(language.Und, collate.Loose) |
| for _, l := range header { |
| for _, l := range lines { |