Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix lint issues, makefile target #1443

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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