Fix errors caught by go vet in compliance package
`go test` implicitly runs `go vet` and fails the tests if vet
errors are found. Fix all the issues found by vet.
Test: go test build/make/tools/compliance/...
Change-Id: If0684cf124ece4931af440008cd44a61c22de475
diff --git a/tools/compliance/cmd/htmlnotice.go b/tools/compliance/cmd/htmlnotice.go
index cff1ff8..3456a49 100644
--- a/tools/compliance/cmd/htmlnotice.go
+++ b/tools/compliance/cmd/htmlnotice.go
@@ -74,12 +74,12 @@
} 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 @@
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 @@
}
fmt.Fprintln(ctx.stdout, "<!DOCTYPE html>")
- fmt.Fprintln(ctx.stdout, "<html><head>\n")
+ fmt.Fprintln(ctx.stdout, "<html><head>")
fmt.Fprintln(ctx.stdout, "<style type=\"text/css\">")
fmt.Fprintln(ctx.stdout, "body { padding: 2px; margin: 0; }")
fmt.Fprintln(ctx.stdout, "ul { list-style-type: none; margin: 0; padding: 0; }")
fmt.Fprintln(ctx.stdout, "li { padding-left: 1em; }")
fmt.Fprintln(ctx.stdout, ".file-list { margin-left: 1em; }")
- fmt.Fprintln(ctx.stdout, "</style>\n")
+ fmt.Fprintln(ctx.stdout, "</style>")
if 0 < len(ctx.title) {
fmt.Fprintf(ctx.stdout, "<title>%s</title>\n", html.EscapeString(ctx.title))
}