chore(ninja): check fmt.Fprintln returns in publish warnings (errcheck)

Pre-existing strict-lint failures in the publish warning helpers were
the only thing keeping check-safety's Go lint lane red for the module;
discard the writer errors explicitly (warnings are best-effort output).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Alex Dunmow 2026-07-03 13:53:46 +08:00
parent 9bbc793563
commit dc621e6d96

View File

@ -1115,11 +1115,11 @@ func gitignoredTrackedWarning(repoDir string, w io.Writer) {
if names == "" { if names == "" {
return return
} }
fmt.Fprintln(w, "warning: these tracked files match .gitignore and will still be shipped:") _, _ = fmt.Fprintln(w, "warning: these tracked files match .gitignore and will still be shipped:")
for n := range strings.SplitSeq(names, "\n") { for n := range strings.SplitSeq(names, "\n") {
fmt.Fprintln(w, " "+n) _, _ = fmt.Fprintln(w, " "+n)
} }
fmt.Fprintln(w, " (run `git rm --cached <file>` to drop)") _, _ = fmt.Fprintln(w, " (run `git rm --cached <file>` to drop)")
} }
// untrackedFilesWarning writes a warning to w listing untracked files in // untrackedFilesWarning writes a warning to w listing untracked files in
@ -1134,11 +1134,11 @@ func untrackedFilesWarning(repoDir string, w io.Writer) {
if names == "" { if names == "" {
return return
} }
fmt.Fprintln(w, "warning: these untracked files will NOT be in the archive:") _, _ = fmt.Fprintln(w, "warning: these untracked files will NOT be in the archive:")
for n := range strings.SplitSeq(names, "\n") { for n := range strings.SplitSeq(names, "\n") {
fmt.Fprintln(w, " "+n) _, _ = fmt.Fprintln(w, " "+n)
} }
fmt.Fprintln(w, " (run `git add <file>` if they should be shipped)") _, _ = fmt.Fprintln(w, " (run `git add <file>` if they should be shipped)")
} }
// emitPublishWarnings runs the publish-time warning helpers in the order the // emitPublishWarnings runs the publish-time warning helpers in the order the
@ -1181,11 +1181,11 @@ func submoduleWarning(repoDir string, w io.Writer) {
if len(paths) == 0 { if len(paths) == 0 {
return return
} }
fmt.Fprintln(w, "warning: this repo has submodules; git archive will ship them as empty directories:") _, _ = fmt.Fprintln(w, "warning: this repo has submodules; git archive will ship them as empty directories:")
for _, p := range paths { for _, p := range paths {
fmt.Fprintln(w, " "+p) _, _ = fmt.Fprintln(w, " "+p)
} }
fmt.Fprintln(w, " (vendor the contents or pack them separately if the plugin depends on them)") _, _ = fmt.Fprintln(w, " (vendor the contents or pack them separately if the plugin depends on them)")
} }
// autoCommitPluginMod stages and commits plugin.mod with the given message, // autoCommitPluginMod stages and commits plugin.mod with the given message,