diff --git a/internal/chlog/client.go b/internal/chlog/client.go index 2451511..8d78da9 100644 --- a/internal/chlog/client.go +++ b/internal/chlog/client.go @@ -42,7 +42,7 @@ func (r Row) Time() time.Time { func (r Row) Key() uint64 { h := fnv.New64a() for _, s := range []string{r.Timestamp, r.Host, r.Source, r.Namespace, r.Pod, r.Container, r.Stream, r.Message} { - io.WriteString(h, s) + _, _ = io.WriteString(h, s) h.Write([]byte{0}) } return h.Sum64() @@ -81,7 +81,7 @@ func (c *Client) Run(ctx context.Context, q Query, fn func(Row) error) error { if err != nil { return fmt.Errorf("clickhouse request: %w", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { body, _ := io.ReadAll(io.LimitReader(resp.Body, 4096)) diff --git a/internal/chlog/client_test.go b/internal/chlog/client_test.go index bf18bea..ef3f24d 100644 --- a/internal/chlog/client_test.go +++ b/internal/chlog/client_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "io" "net/http" "net/http/httptest" "strconv" @@ -54,8 +55,7 @@ func (f *fakeCH) handler(t *testing.T) http.HandlerFunc { f.queries++ f.lastUser = r.Header.Get("X-ClickHouse-User") f.lastPass = r.Header.Get("X-ClickHouse-Key") - body := make([]byte, r.ContentLength) - r.Body.Read(body) + body, _ := io.ReadAll(r.Body) f.lastSQL = string(body) q := r.URL.Query() @@ -80,7 +80,7 @@ func (f *fakeCH) handler(t *testing.T) http.HandlerFunc { if limit >= 0 && sent >= limit { break } - enc.Encode(row) + _ = enc.Encode(row) sent++ } } diff --git a/main.go b/main.go index 34affc9..821b98c 100644 --- a/main.go +++ b/main.go @@ -141,8 +141,8 @@ func newTailCmd(use string) *cobra.Command { }, } cf.register(cmd, 0) - cmd.Flags().MarkHidden("until") - cmd.Flags().MarkHidden("limit") + _ = cmd.Flags().MarkHidden("until") + _ = cmd.Flags().MarkHidden("limit") return cmd }