Multiple style updates (#1974)

* Comment style

* IRecordTransformer -> RecordTransfomer

* make fmt

* else-return style mod

* snake-case -> camel-case

* Remove redundant err = nil and similar zero-value initializations.

* redundant break;

* bugfix

* neaten

* typofix

* simplify/standardize init of zero-length slices

* Standardize fmt.Fprintf w/ errors

* fix double print of "mlr:"

* neatening

* Uniformize error messages

* make docs

* avoid shadowing package names

* shorten some receiver names
This commit is contained in:
John Kerl 2026-02-16 15:49:21 -05:00 committed by GitHub
parent a3b5d25933
commit 5eb40c9e7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
307 changed files with 1649 additions and 2555 deletions

View file

@ -1,7 +1,5 @@
// ================================================================
// Support for Miller regression testing. Originally bash scripts; ported to Go
// for ease of Windows-native testing.
// ================================================================
package auxents

View file

@ -6,9 +6,7 @@ import (
"os"
)
// ================================================================
// Copyright (c) 1998 John Kerl.
// ================================================================
// This is a simple hex dump with hex offsets to the left, hex data in the
// middle, and ASCII at the right. This is a subset of the functionality of
// Unix od; I wrote it in my NT days.
@ -24,7 +22,6 @@ import (
// 00000050: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_|
// 00000060: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno|
// 00000070: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.|
// ================================================================
func hexUsage(verbName string, o *os.File, exitCode int) {
fmt.Fprintf(o, "Usage: mlr %s [options] {zero or more file names}\n", verbName)
@ -64,7 +61,7 @@ func hexMain(args []string) int {
istream, err := os.Open(filename)
if err != nil {
// TODO: "mlr"
fmt.Fprintln(os.Stderr, "mlr hex:", err)
fmt.Fprintf(os.Stderr, "mlr hex: %v\n", err)
os.Exit(1)
}
@ -101,7 +98,7 @@ func hexDumpFile(istream *os.File, doRaw bool) {
// exact multiple of our buffer size. We'll break the loop after
// hex-dumping this last, partial fragment.
if err != nil && err != io.ErrUnexpectedEOF {
fmt.Fprintln(os.Stderr, "mlr hex:", err)
fmt.Fprintf(os.Stderr, "mlr hex: %v\n", err)
os.Exit(1)
}

View file

@ -48,7 +48,7 @@ func lecatMain(args []string) int {
istream, err := os.Open(filename)
if err != nil {
fmt.Fprintln(os.Stderr, "mlr lecat:", err)
fmt.Fprintf(os.Stderr, "mlr lecat: %v\n", err)
os.Exit(1)
}

View file

@ -82,14 +82,14 @@ func termcvtMain(args []string) int {
istream, err := os.Open(filename)
if err != nil {
// TODO: "mlr"
fmt.Fprintln(os.Stderr, "mlr termcvt:", err)
fmt.Fprintf(os.Stderr, "mlr termcvt: %v\n", err)
os.Exit(1)
}
ostream, err := os.Open(tempname)
if err != nil {
// TODO: "mlr"
fmt.Fprintln(os.Stderr, "mlr termcvt:", err)
fmt.Fprintf(os.Stderr, "mlr termcvt: %v\n", err)
os.Exit(1)
}
@ -102,7 +102,7 @@ func termcvtMain(args []string) int {
err = os.Rename(tempname, filename)
if err != nil {
// TODO: "mlr"
fmt.Fprintln(os.Stderr, "mlr termcvt:", err)
fmt.Fprintf(os.Stderr, "mlr termcvt: %v\n", err)
os.Exit(1)
}
}
@ -113,7 +113,7 @@ func termcvtMain(args []string) int {
istream, err := os.Open(filename)
if err != nil {
// TODO: "mlr"
fmt.Fprintln(os.Stderr, "mlr termcvt:", err)
fmt.Fprintf(os.Stderr, "mlr termcvt: %v\n", err)
os.Exit(1)
}
@ -137,7 +137,7 @@ func termcvtFile(istream *os.File, ostream *os.File, inputTerminator string, out
if err != nil {
// TODO: "mlr"
fmt.Fprintln(os.Stderr, "mlr termcvt:", err)
fmt.Fprintf(os.Stderr, "mlr termcvt: %v\n", err)
os.Exit(1)
}

View file

@ -35,7 +35,7 @@ func unhexMain(args []string) int {
for _, filename := range args {
istream, err := os.Open(filename)
if err != nil {
fmt.Fprintln(os.Stderr, "mlr unhex:", err)
fmt.Fprintf(os.Stderr, "mlr unhex: %v\n", err)
os.Exit(1)
}
unhexFile(istream, os.Stdout)
@ -62,7 +62,7 @@ func unhexFile(istream *os.File, ostream *os.File) {
break
}
if err != nil {
fmt.Fprintln(os.Stderr, "mlr unhex:", err)
fmt.Fprintf(os.Stderr, "mlr unhex: %v\n", err)
os.Exit(1)
}
@ -75,7 +75,7 @@ func unhexFile(istream *os.File, ostream *os.File) {
if field != "" {
n, err := fmt.Sscanf(field, "%x", &scanValue)
if err != nil {
fmt.Fprintln(os.Stderr, "mlr unhex:", err)
fmt.Fprintf(os.Stderr, "mlr unhex: %v\n", err)
os.Exit(1)
}
if n != 1 {