diff --git a/tools/compliance/cmd/bom.go b/tools/compliance/cmd/bom.go index f6cb72c2d1..ec0160318f 100644 --- a/tools/compliance/cmd/bom.go +++ b/tools/compliance/cmd/bom.go @@ -69,12 +69,12 @@ func main() { } else { dir, err := filepath.Abs(filepath.Dir(*outputFile)) if err != nil { - fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err) os.Exit(1) } fi, err := os.Stat(dir) if err != nil { - fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err) os.Exit(1) } if !fi.IsDir() { @@ -102,7 +102,7 @@ func main() { if *outputFile != "-" { err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666) if err != nil { - fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err) os.Exit(1) } } diff --git a/tools/compliance/cmd/bom_test.go b/tools/compliance/cmd/bom_test.go index 9c126710ac..fc61bbf0db 100644 --- a/tools/compliance/cmd/bom_test.go +++ b/tools/compliance/cmd/bom_test.go @@ -275,7 +275,7 @@ func Test(t *testing.T) { err := billOfMaterials(&ctx, rootFiles...) if err != nil { - t.Fatalf("bom: error = %w, stderr = %v", err, stderr) + t.Fatalf("bom: error = %v, stderr = %v", err, stderr) return } if stderr.Len() > 0 { diff --git a/tools/compliance/cmd/dumpgraph_test.go b/tools/compliance/cmd/dumpgraph_test.go index 305502239c..6555aab3b6 100644 --- a/tools/compliance/cmd/dumpgraph_test.go +++ b/tools/compliance/cmd/dumpgraph_test.go @@ -1217,7 +1217,7 @@ func Test_graphviz(t *testing.T) { outList := strings.Split(stdout.String(), "\n") outLine := 0 if outList[outLine] != "strict digraph {" { - t.Errorf("dumpgraph: got 1st line %v, want strict digraph {") + t.Errorf("dumpgraph: got 1st line %v, want strict digraph {", outList[outLine]) } outLine++ if strings.HasPrefix(strings.TrimLeft(outList[outLine], " \t"), "rankdir") { diff --git a/tools/compliance/cmd/dumpresolutions_test.go b/tools/compliance/cmd/dumpresolutions_test.go index a3a298e988..1abfac7da4 100644 --- a/tools/compliance/cmd/dumpresolutions_test.go +++ b/tools/compliance/cmd/dumpresolutions_test.go @@ -3305,7 +3305,7 @@ func Test_graphviz(t *testing.T) { outList := strings.Split(stdout.String(), "\n") outLine := 0 if outList[outLine] != "strict digraph {" { - t.Errorf("dumpresolutions: got 1st line %v, want strict digraph {") + t.Errorf("dumpresolutions: got 1st line %v, want strict digraph {", outList[outLine]) } outLine++ if strings.HasPrefix(strings.TrimLeft(outList[outLine], " \t"), "rankdir") { diff --git a/tools/compliance/cmd/htmlnotice.go b/tools/compliance/cmd/htmlnotice.go index cff1ff84eb..3456a49026 100644 --- a/tools/compliance/cmd/htmlnotice.go +++ b/tools/compliance/cmd/htmlnotice.go @@ -74,12 +74,12 @@ func main() { } else { dir, err := filepath.Abs(filepath.Dir(*outputFile)) if err != nil { - fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err) os.Exit(1) } fi, err := os.Stat(dir) if err != nil { - fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err) os.Exit(1) } if !fi.IsDir() { @@ -107,7 +107,7 @@ func main() { if *outputFile != "-" { err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666) if err != nil { - fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err) os.Exit(1) } } @@ -139,13 +139,13 @@ func htmlNotice(ctx *context, files ...string) error { } fmt.Fprintln(ctx.stdout, "") - fmt.Fprintln(ctx.stdout, "\n") + fmt.Fprintln(ctx.stdout, "") fmt.Fprintln(ctx.stdout, "\n") + fmt.Fprintln(ctx.stdout, "") if 0 < len(ctx.title) { fmt.Fprintf(ctx.stdout, "%s\n", html.EscapeString(ctx.title)) } diff --git a/tools/compliance/cmd/htmlnotice_test.go b/tools/compliance/cmd/htmlnotice_test.go index 8d3ea02703..35a25bf4b3 100644 --- a/tools/compliance/cmd/htmlnotice_test.go +++ b/tools/compliance/cmd/htmlnotice_test.go @@ -560,7 +560,7 @@ func Test(t *testing.T) { err := htmlNotice(&ctx, rootFiles...) if err != nil { - t.Fatalf("htmlnotice: error = %w, stderr = %v", err, stderr) + t.Fatalf("htmlnotice: error = %v, stderr = %v", err, stderr) return } if stderr.Len() > 0 { diff --git a/tools/compliance/cmd/shippedlibs.go b/tools/compliance/cmd/shippedlibs.go index 290ced65c2..ee74cad0dc 100644 --- a/tools/compliance/cmd/shippedlibs.go +++ b/tools/compliance/cmd/shippedlibs.go @@ -66,12 +66,12 @@ func main() { } else { dir, err := filepath.Abs(filepath.Dir(*outputFile)) if err != nil { - fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err) os.Exit(1) } fi, err := os.Stat(dir) if err != nil { - fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err) os.Exit(1) } if !fi.IsDir() { @@ -99,7 +99,7 @@ func main() { if *outputFile != "-" { err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666) if err != nil { - fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err) os.Exit(1) } } diff --git a/tools/compliance/cmd/shippedlibs_test.go b/tools/compliance/cmd/shippedlibs_test.go index 4b2e4ee18f..dbf32745c0 100644 --- a/tools/compliance/cmd/shippedlibs_test.go +++ b/tools/compliance/cmd/shippedlibs_test.go @@ -194,7 +194,7 @@ func Test(t *testing.T) { err := shippedLibs(&ctx, rootFiles...) if err != nil { - t.Fatalf("shippedLibs: error = %w, stderr = %v", err, stderr) + t.Fatalf("shippedLibs: error = %v, stderr = %v", err, stderr) return } if stderr.Len() > 0 { diff --git a/tools/compliance/cmd/textnotice.go b/tools/compliance/cmd/textnotice.go index 91c57b03e9..658d6098bf 100644 --- a/tools/compliance/cmd/textnotice.go +++ b/tools/compliance/cmd/textnotice.go @@ -69,12 +69,12 @@ func main() { } else { dir, err := filepath.Abs(filepath.Dir(*outputFile)) if err != nil { - fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err) os.Exit(1) } fi, err := os.Stat(dir) if err != nil { - fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err) + fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err) os.Exit(1) } if !fi.IsDir() { @@ -102,7 +102,7 @@ func main() { if *outputFile != "-" { err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666) if err != nil { - fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err) + fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err) os.Exit(1) } } diff --git a/tools/compliance/cmd/textnotice_test.go b/tools/compliance/cmd/textnotice_test.go index 156fb90486..8b6a4b5570 100644 --- a/tools/compliance/cmd/textnotice_test.go +++ b/tools/compliance/cmd/textnotice_test.go @@ -474,7 +474,7 @@ func Test(t *testing.T) { err := textNotice(&ctx, rootFiles...) if err != nil { - t.Fatalf("textnotice: error = %w, stderr = %v", err, stderr) + t.Fatalf("textnotice: error = %v, stderr = %v", err, stderr) return } if stderr.Len() > 0 { diff --git a/tools/compliance/conditionset_test.go b/tools/compliance/conditionset_test.go index 1d80676354..c91912f19f 100644 --- a/tools/compliance/conditionset_test.go +++ b/tools/compliance/conditionset_test.go @@ -363,7 +363,7 @@ func TestConditionSet(t *testing.T) { } actualConditions := actual.AsList() if len(actualConditions) != len(expectedConditions) { - t.Errorf("len(MatchingAny(%d).AsList()): got %d, want %d", + t.Errorf("len(MatchingAny(%s).AsList()): got %d, want %d", data, len(actualNames), len(expectedNames)) } else { for i := 0; i < len(actualNames); i++ { @@ -452,7 +452,7 @@ func TestConditionSet(t *testing.T) { for i := 0; i < len(actualConditions); i++ { if actualConditions[i] != expectedConditions[i] { t.Errorf("actual.AsList()[%d]: got %s, want %s", - i, actualConditions[i], expectedConditions[i]) + i, actualConditions[i].Name(), expectedConditions[i].Name()) break } } @@ -552,7 +552,7 @@ func TestConditionSet(t *testing.T) { for i := 0; i < len(actualConditions); i++ { if actualConditions[i] != expectedConditions[i] { t.Errorf("actual.AsList()[%d}: got %s, want %s", - i, actualConditions[i], expectedConditions[i]) + i, actualConditions[i].Name(), expectedConditions[i].Name()) break } } diff --git a/tools/compliance/policy/policy_test.go b/tools/compliance/policy/policy_test.go index 09e831cc23..32dd5fd52d 100644 --- a/tools/compliance/policy/policy_test.go +++ b/tools/compliance/policy/policy_test.go @@ -226,7 +226,7 @@ func TestPolicy_edgeConditions(t *testing.T) { fs[tt.edge.dep] = []byte(meta[tt.edge.dep]) lg, err := ReadLicenseGraph(&fs, stderr, []string{tt.edge.target}) if err != nil { - t.Errorf("unexpected error reading graph: %w", err) + t.Errorf("unexpected error reading graph: %s", err) return } edge := lg.Edges()[0] diff --git a/tools/compliance/policy/resolve_test.go b/tools/compliance/policy/resolve_test.go index 09dd7dd3c8..f98e4cc23a 100644 --- a/tools/compliance/policy/resolve_test.go +++ b/tools/compliance/policy/resolve_test.go @@ -332,7 +332,7 @@ func TestResolveBottomUpConditions(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } @@ -643,7 +643,7 @@ func TestResolveTopDownConditions(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } diff --git a/tools/compliance/policy/resolvenotices_test.go b/tools/compliance/policy/resolvenotices_test.go index 275c0a5fe2..cd9dd71bdc 100644 --- a/tools/compliance/policy/resolvenotices_test.go +++ b/tools/compliance/policy/resolvenotices_test.go @@ -457,7 +457,7 @@ func TestResolveNotices(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } expectedRs := toResolutionSet(lg, tt.expectedResolutions) diff --git a/tools/compliance/policy/resolveprivacy_test.go b/tools/compliance/policy/resolveprivacy_test.go index 2072d22d58..e8c953a8fe 100644 --- a/tools/compliance/policy/resolveprivacy_test.go +++ b/tools/compliance/policy/resolveprivacy_test.go @@ -76,7 +76,7 @@ func TestResolveSourcePrivacy(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } expectedRs := toResolutionSet(lg, tt.expectedResolutions) diff --git a/tools/compliance/policy/resolveshare_test.go b/tools/compliance/policy/resolveshare_test.go index f73888de43..c451b86040 100644 --- a/tools/compliance/policy/resolveshare_test.go +++ b/tools/compliance/policy/resolveshare_test.go @@ -286,7 +286,7 @@ func TestResolveSourceSharing(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } expectedRs := toResolutionSet(lg, tt.expectedResolutions) diff --git a/tools/compliance/policy/shareprivacyconflicts_test.go b/tools/compliance/policy/shareprivacyconflicts_test.go index 2d2a1d0258..069daa2d6c 100644 --- a/tools/compliance/policy/shareprivacyconflicts_test.go +++ b/tools/compliance/policy/shareprivacyconflicts_test.go @@ -99,7 +99,7 @@ func TestConflictingSharedPrivateSource(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } expectedConflicts := toConflictList(lg, tt.expectedConflicts) diff --git a/tools/compliance/policy/shipped_test.go b/tools/compliance/policy/shipped_test.go index 25f6af0ca3..3ae9b4687e 100644 --- a/tools/compliance/policy/shipped_test.go +++ b/tools/compliance/policy/shipped_test.go @@ -108,7 +108,7 @@ func TestShippedNodes(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } t.Logf("graph:") diff --git a/tools/compliance/policy/walk_test.go b/tools/compliance/policy/walk_test.go index a2ec6e7a84..92867f9535 100644 --- a/tools/compliance/policy/walk_test.go +++ b/tools/compliance/policy/walk_test.go @@ -620,7 +620,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } expectedRs := toResolutionSet(lg, tt.expectedResolutions) @@ -1228,7 +1228,7 @@ func TestWalkActionsForCondition(t *testing.T) { stderr := &bytes.Buffer{} lg, err := toGraph(stderr, tt.roots, tt.edges) if err != nil { - t.Errorf("unexpected test data error: got %w, want no error", err) + t.Errorf("unexpected test data error: got %s, want no error", err) return } expectedAs := toActionSet(lg, tt.expectedActions) diff --git a/tools/compliance/readgraph_test.go b/tools/compliance/readgraph_test.go index 6ff7a6c4f8..db52fb193b 100644 --- a/tools/compliance/readgraph_test.go +++ b/tools/compliance/readgraph_test.go @@ -88,9 +88,9 @@ func TestReadLicenseGraph(t *testing.T) { lg, err := ReadLicenseGraph(tt.fs, stderr, tt.roots) if err != nil { if len(tt.expectedError) == 0 { - t.Errorf("unexpected error: got %w, want no error", err) + t.Errorf("unexpected error: got %s, want no error", err) } else if !strings.Contains(err.Error(), tt.expectedError) { - t.Errorf("unexpected error: got %w, want %q", err, tt.expectedError) + t.Errorf("unexpected error: got %s, want %q", err, tt.expectedError) } return }