diff --git a/code_gen/build_casefolding_table.go b/code_gen/build_casefolding_table.go index 4211f7d..7bf92ef 100644 --- a/code_gen/build_casefolding_table.go +++ b/code_gen/build_casefolding_table.go @@ -43,21 +43,21 @@ func main() { } resp, err := http.Get(CaseFoldingURL) if err != nil { - fatalF("Can't fetch CaseFolding.txt: " + err.Error()) + fatal("Can't fetch CaseFolding.txt: " + err.Error()) } defer func() { _ = resp.Body.Close() }() cff, err := os.Create(CaseFoldingDB + ".tmp") if err != nil { - fatalF("Opening CaseFolding.txt: " + err.Error()) + fatal("Opening CaseFolding.txt: " + err.Error()) } _, err = cff.Write([]byte(CFFheader)) if err != nil { - fatalF("Write CFF header: " + err.Error()) + fatal("Write CFF header: " + err.Error()) } lines := bufio.NewReader(resp.Body) re, err := regexp.Compile(reString) if err != nil { - fatalF("RE compile: " + err.Error()) + fatal("RE compile: " + err.Error()) } mappings := make(map[string]string) @@ -66,7 +66,7 @@ func main() { if errors.Is(err, io.EOF) { break } else if err != nil { - fatalF("Error reading CaseFolding.txt: " + err.Error()) + fatal("Error reading CaseFolding.txt: " + err.Error()) } if line[0] == '#' || len(line) == 1 { continue @@ -97,13 +97,13 @@ func main() { if onLine == PairsPerLine { _, err = cff.WriteString("\n\t") if err != nil { - fatalF("failed to write line-end: " + err.Error()) + fatal("failed to write line-end: " + err.Error()) } onLine = 0 } _, err = fmt.Fprintf(cff, "0x%s: 0x%s, ", lhs, rhs) if err != nil { - fatalF("failed to write pair: " + err.Error()) + fatal("failed to write pair: " + err.Error()) } onLine++ } @@ -112,10 +112,14 @@ func main() { fmt.Printf("Rebuilt case_folding.go with %d codepoint pairs.\n", len(mappings)) err = os.Rename(CaseFoldingDB+".tmp", CaseFoldingDB) if err != nil { - fatalF("Error switching in %s: " + err.Error()) + fatalF("Error switching in %s: ", err.Error()) } } +func fatal(message string) { + _, _ = fmt.Fprintln(os.Stderr, message) + os.Exit(1) +} func fatalF(format string, args ...any) { _, _ = fmt.Fprintf(os.Stderr, format, args...) os.Exit(1) diff --git a/core_matcher_test.go b/core_matcher_test.go index e9696bd..43f83ce 100644 --- a/core_matcher_test.go +++ b/core_matcher_test.go @@ -99,7 +99,7 @@ func TestExistsFalseOrder(t *testing.T) { for _, match := range matches { msg += fmt.Sprintf(" %s\n", match) } - t.Errorf(msg) + t.Error(msg) } } diff --git a/generic_machine_test.go b/generic_machine_test.go index 382ac7c..f3bc7f4 100644 --- a/generic_machine_test.go +++ b/generic_machine_test.go @@ -83,7 +83,7 @@ func TestRulerNestedArrays(t *testing.T) { r2, err := q.MatchesForEvent(event2) if err != nil { - t.Errorf("Matches " + err.Error()) + t.Error("Matches " + err.Error()) } if len(r2) != 0 { t.Errorf("r2 matchd %d", len(r2)) @@ -91,7 +91,7 @@ func TestRulerNestedArrays(t *testing.T) { r3, err := q.MatchesForEvent(event3) if err != nil { - t.Errorf("Matches " + err.Error()) + t.Error("Matches " + err.Error()) } if len(r3) != 0 { t.Errorf("r3 matchd %d", len(r2)) @@ -99,7 +99,7 @@ func TestRulerNestedArrays(t *testing.T) { r4, err := q.MatchesForEvent(event4) if err != nil { - t.Errorf("Matches " + err.Error()) + t.Error("Matches " + err.Error()) } if len(r4) != 1 || r4[0] != "rule3" { var msg string diff --git a/pruner.go b/pruner.go index fe2fcd3..9b02bee 100644 --- a/pruner.go +++ b/pruner.go @@ -98,10 +98,10 @@ type tooMuchFiltering struct { MinAction int64 } -func newTooMuchFiltering(ratio float64, min int64) *tooMuchFiltering { +func newTooMuchFiltering(ratio float64, minimum int64) *tooMuchFiltering { return &tooMuchFiltering{ FilteredToEmitted: ratio, - MinAction: min, + MinAction: minimum, } } diff --git a/quamina_test.go b/quamina_test.go index 6eeeb9d..79996ce 100644 --- a/quamina_test.go +++ b/quamina_test.go @@ -166,7 +166,7 @@ func TestCityLots(t *testing.T) { that is slower than the one the software was developed on, in which case you might want to readjust the "thresholdPerformance" constant. However, it may be that you made a change that reduced the throughput of the library, which would be unacceptable.` - t.Errorf(message1 + message2) + t.Error(message1 + message2) } if len(results) != len(wanted) { diff --git a/rebuilding.go b/rebuilding.go index 03ff0e0..fb43e9a 100644 --- a/rebuilding.go +++ b/rebuilding.go @@ -15,10 +15,10 @@ type liveRatioTrigger struct { MinLive int } -func newLiveRatioTrigger(ratio float64, min int) *liveRatioTrigger { +func newLiveRatioTrigger(ratio float64, minimum int) *liveRatioTrigger { return &liveRatioTrigger{ Ratio: ratio, - MinLive: min, + MinLive: minimum, } }