Skip to content

Commit

Permalink
ci: Fix lint issues, makefile target
Browse files Browse the repository at this point in the history
  • Loading branch information
mway committed May 30, 2024
1 parent 4425037 commit 4890655
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ golangci-lint:
@$(foreach mod,$(MODULE_DIRS), \
(cd $(mod) && \
echo "[lint] golangci-lint: $(mod)" && \
golangci-lint run --path-prefix $(mod)) &&) true
golangci-lint run --path-prefix $(mod) ./...) &&) true

.PHONY: tidy
tidy:
Expand Down
2 changes: 1 addition & 1 deletion http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import (
func (lvl AtomicLevel) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err := lvl.serveHTTP(w, r); err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "internal error: %v", err)
_, _ = fmt.Fprintf(w, "internal error: %v", err)
}
}

Expand Down
6 changes: 5 additions & 1 deletion logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {

if stack.Count() == 0 {
if log.addCaller {
fmt.Fprintf(log.errorOutput, "%v Logger.check error: failed to get caller\n", ent.Time.UTC())
_, _ = fmt.Fprintf(
log.errorOutput,
"%v Logger.check error: failed to get caller\n",
ent.Time.UTC(),
)
_ = log.errorOutput.Sync()
}
return ce
Expand Down
6 changes: 5 additions & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ func IncreaseLevel(lvl zapcore.LevelEnabler) Option {
return optionFunc(func(log *Logger) {
core, err := zapcore.NewIncreaseLevelCore(log.core, lvl)
if err != nil {
fmt.Fprintf(log.errorOutput, "failed to IncreaseLevel: %v\n", err)
_, _ = fmt.Fprintf(
log.errorOutput,
"failed to IncreaseLevel: %v\n",
err,
)
} else {
log.core = core
}
Expand Down
2 changes: 1 addition & 1 deletion zapcore/console_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
if i > 0 {
line.AppendString(c.ConsoleSeparator)
}
fmt.Fprint(line, arr.elems[i])
_, _ = fmt.Fprint(line, arr.elems[i])
}
putSliceEncoder(arr)

Expand Down
14 changes: 12 additions & 2 deletions zapcore/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,12 @@ func (ce *CheckedEntry) Write(fields ...Field) {
// If the entry is dirty, log an internal error; because the
// CheckedEntry is being used after it was returned to the pool,
// the message may be an amalgamation from multiple call sites.
fmt.Fprintf(ce.ErrorOutput, "%v Unsafe CheckedEntry re-use near Entry %+v.\n", ce.Time, ce.Entry)
_, _ = fmt.Fprintf(
ce.ErrorOutput,
"%v Unsafe CheckedEntry re-use near Entry %+v.\n",
ce.Time,
ce.Entry,
)
_ = ce.ErrorOutput.Sync() // ignore error
}
return
Expand All @@ -253,7 +258,12 @@ func (ce *CheckedEntry) Write(fields ...Field) {
err = multierr.Append(err, ce.cores[i].Write(ce.Entry, fields))
}
if err != nil && ce.ErrorOutput != nil {
fmt.Fprintf(ce.ErrorOutput, "%v write error: %v\n", ce.Time, err)
_, _ = fmt.Fprintf(
ce.ErrorOutput,
"%v write error: %v\n",
ce.Time,
err,
)
_ = ce.ErrorOutput.Sync() // ignore error
}

Expand Down

0 comments on commit 4890655

Please sign in to comment.