summaryrefslogtreecommitdiff
path: root/internal/io/dlog
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2024-02-23 15:01:41 +0200
committerPaul Buetow <pbuetow@mimecast.com>2024-02-23 15:01:41 +0200
commita3e10757a52fa47a0608afd88986162ca5eb22cc (patch)
treedce61c6695bc3badd455a64767252e6947b32711 /internal/io/dlog
parent85780654df870dc4170b93a8ed5a5dbfa917fe5d (diff)
lint warnings
Diffstat (limited to 'internal/io/dlog')
-rw-r--r--internal/io/dlog/dlog.go5
-rw-r--r--internal/io/dlog/loggers/file.go7
-rw-r--r--internal/io/dlog/loggers/stdout.go2
3 files changed, 6 insertions, 8 deletions
diff --git a/internal/io/dlog/dlog.go b/internal/io/dlog/dlog.go
index c5ab8f8..258fb68 100644
--- a/internal/io/dlog/dlog.go
+++ b/internal/io/dlog/dlog.go
@@ -3,7 +3,6 @@ package dlog
import (
"context"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -225,14 +224,14 @@ func (d *DLog) Mapreduce(table string, data map[string]interface{}) string {
// level|date-time|process|caller|cpus|goroutines|cgocalls|loadavg|uptime|MAPREDUCE:TABLE|key=value|...
var loadAvg string
- if loadAvgBytes, err := ioutil.ReadFile("/proc/loadavg"); err == nil {
+ if loadAvgBytes, err := os.ReadFile("/proc/loadavg"); err == nil {
tmp := string(loadAvgBytes)
s := strings.SplitN(tmp, " ", 2)
loadAvg = s[0]
}
var uptime string
- if uptimeBytes, err := ioutil.ReadFile("/proc/uptime"); err == nil {
+ if uptimeBytes, err := os.ReadFile("/proc/uptime"); err == nil {
tmp := string(uptimeBytes)
s := strings.SplitN(tmp, ".", 2)
i, _ := strconv.ParseInt(s[0], 10, 64)
diff --git a/internal/io/dlog/loggers/file.go b/internal/io/dlog/loggers/file.go
index 6a09353..8e567bc 100644
--- a/internal/io/dlog/loggers/file.go
+++ b/internal/io/dlog/loggers/file.go
@@ -12,8 +12,6 @@ import (
"github.com/mimecast/dtail/internal/config"
)
-type fileWriter struct{}
-
type fileMessageBuf struct {
now time.Time
message string
@@ -124,9 +122,10 @@ func (f *file) write(m *fileMessageBuf) {
writer = f.getWriter(f.strategy.FileBase)
}
- writer.WriteString(m.message)
+ // Don't report any error, we won't be able to log it anyway!
+ _, _ = writer.WriteString(m.message)
if m.nl {
- writer.WriteByte('\n')
+ _ = writer.WriteByte('\n')
}
}
diff --git a/internal/io/dlog/loggers/stdout.go b/internal/io/dlog/loggers/stdout.go
index ef30855..b024243 100644
--- a/internal/io/dlog/loggers/stdout.go
+++ b/internal/io/dlog/loggers/stdout.go
@@ -69,4 +69,4 @@ func (s *stdout) Rotate() {
// This is empty because it isn't doing anything but has to satisfy the interface.
}
-func (stdout) SupportsColors() bool { return true }
+func (*stdout) SupportsColors() bool { return true }