Skip to content

Commit

Permalink
Resolve some more, sensible staticcheck suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
mat committed Oct 3, 2024
1 parent 0940eb6 commit 8d4f471
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
6 changes: 0 additions & 6 deletions besticon/iconserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,6 @@ func assertStringEquals(t *testing.T, expected string, actual string) {
}
}

func assertIntegerEquals(t *testing.T, expected int, actual int) {
if expected != actual {
fail(t, fmt.Sprintf("Expected %d to be %d", actual, expected))
}
}

func assertIntegerInInterval(t *testing.T, lower int, upper int, actual int) {
if actual < lower || actual > upper {
fail(t, fmt.Sprintf("Expected %d to be in interval [%d,%d]", actual, lower, upper))
Expand Down
6 changes: 0 additions & 6 deletions ico/ico.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ func parseIcondirEntry(r io.Reader, e *icondirEntry) error {
return nil
}

type dibHeader struct {
dibHeaderSize uint32
width uint32
height uint32
}

func (e *icondirEntry) ColorCount() int {
if e.PaletteCount == 0 {
return 256
Expand Down
2 changes: 1 addition & 1 deletion lettericon/lettericon.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func RenderPNG(letter string, bgColor color.Color, width int, out io.Writer) err
fg := pickForegroundColor(bgColor)

rgba := image.NewRGBA(image.Rect(0, 0, width, width))
draw.Draw(rgba, rgba.Bounds(), &image.Uniform{bgColor}, image.ZP, draw.Src)
draw.Draw(rgba, rgba.Bounds(), &image.Uniform{bgColor}, image.Point{}, draw.Src)

fontSize := fontSizeFactor * float64(width)
d := &font.Drawer{
Expand Down
4 changes: 2 additions & 2 deletions lettericon/lettericon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func assertCorrectPNGData(t *testing.T, letter string, width int, hexColor strin
}

// "A-144-123456.png"
testdataDir := fmt.Sprintf("testdata/")
testdataDir := "testdata/"
file := fmt.Sprintf(testdataDir+"%s-%d-%s.png", letter, width, hexColor)
fileData, err := bytesFromFile(file)
if err != nil {
Expand All @@ -88,7 +88,7 @@ func assertCorrectSVGData(t *testing.T, letter string, hexColor string) {
imageData := b.Bytes()

// "A-144-123456.png"
testdataDir := fmt.Sprintf("testdata/")
testdataDir := "testdata/"
file := fmt.Sprintf(testdataDir+"%s-%s.svg", letter, hexColor)
fileData, err := bytesFromFile(file)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions vcr/vcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func logResponse(w io.Writer, res *http.Response, body bool) {
const recordSeparator string = "*************vcr*************\n"

func logSeparator(w io.Writer) {
fmt.Fprintf(w, recordSeparator)
fmt.Fprint(w, recordSeparator)
}

var defaultTransport = &http.Transport{}
Expand Down Expand Up @@ -147,7 +147,7 @@ func NewReplayerTransport(reader io.Reader) (*replayerTransport, error) {
r := bufio.NewReader(bytes.NewReader(conversation))

i := 0
for true {
for {
i++
// fmt.Printf("Reading Request %d\n", i)
req, err := http.ReadRequest(r)
Expand All @@ -173,7 +173,7 @@ func NewReplayerTransport(reader io.Reader) (*replayerTransport, error) {
}

bodyBytes := []byte{}
for true {
for {
line, err := r.ReadBytes('\n')
separatorReached := strings.HasSuffix(string(line), recordSeparator)
if separatorReached {
Expand Down

0 comments on commit 8d4f471

Please sign in to comment.