Skip to content

Commit

Permalink
chore: miscellaneous lint work
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Oct 11, 2024
1 parent 3014273 commit dbc5538
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions adaptive/terminal.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package adaptive

import (
"fmt"
"image/color"
"io"
"time"
Expand Down Expand Up @@ -61,10 +62,10 @@ func queryTerminal(
) error {
rd, err := input.NewDriver(in, "", 0)
if err != nil {
return err
return fmt.Errorf("could not create driver: %w", err)
}

defer rd.Close() // nolint: errcheck
defer rd.Close() //nolint: errcheck

done := make(chan struct{}, 1)
defer close(done)
Expand All @@ -77,7 +78,7 @@ func queryTerminal(
}()

if _, err := io.WriteString(out, query); err != nil {
return err
return fmt.Errorf("could not write query: %w", err)
}

for {
Expand Down
11 changes: 6 additions & 5 deletions color.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func Color(c any) color.Color {
if h, err := colorful.Hex(c); err == nil {
return h
} else if i, err := strconv.Atoi(c); err == nil {
if i < 16 {
if i < 16 { //nolint:gomnd
return ansi.BasicColor(i)
} else if i < 256 {
} else if i < 256 { //nolint:gomnd
return ansi.ExtendedColor(i)
}
return ansi.TrueColor(i)
Expand Down Expand Up @@ -97,9 +97,10 @@ type RGBColor struct {
// RGBA returns the RGBA value of this color. This satisfies the Go Color
// interface.
func (c RGBColor) RGBA() (r, g, b, a uint32) {
r |= uint32(c.R) << 8
g |= uint32(c.G) << 8
b |= uint32(c.B) << 8
const shift = 8
r |= uint32(c.R) << shift
g |= uint32(c.G) << shift
b |= uint32(c.B) << shift
a = 0xFFFF //nolint:gomnd
return
}
Expand Down

0 comments on commit dbc5538

Please sign in to comment.