Skip to content

Commit 9b500e7

Browse files
committed
style(linter): fix errors
1 parent 640fa66 commit 9b500e7

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

cmd/zmk-viewer/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func (d debugFlag) BeforeApply() error {
2929
return nil
3030
}
3131

32-
func (v VersionFlag) Decode(ctx *kong.DecodeContext) error { return nil }
33-
func (v VersionFlag) IsBool() bool { return true }
32+
func (v VersionFlag) Decode(_ *kong.DecodeContext) error { return nil }
33+
func (v VersionFlag) IsBool() bool { return true }
3434
func (v VersionFlag) BeforeApply(app *kong.Kong) error {
3535
fmt.Printf("zmk-viewer has version %s built from %s on %s\n", version, commit, date)
3636
app.Exit(0)

internal/lib/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ func drawBehavior(ctx *gg.Context, key *keymap.Behavior, x float64, y float64) {
108108
for i, v := range key.Params {
109109
str := ""
110110
if v.KeyCode == nil {
111-
str = str + fmt.Sprintf("%v", *v.Number)
111+
str += fmt.Sprintf("%v", *v.Number)
112112
} else {
113-
str = str + *v.KeyCode
113+
str += *v.KeyCode
114114
}
115115

116116
dw, dh := ctx.MeasureString(str)

internal/lib/root.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type GenerateCmd struct {
1515
KeyboardName string `arg:"" help:"Keyboard name to fetch layout."`
1616

1717
File string `optional:"" short:"f" type:"existingfile" help:"ZMK .keymap file"`
18-
LayoutFile string `optional:"" short:"l" type:"layoutfile" help:"info.json file"`
18+
LayoutFile string `optional:"" short:"l" type:"existingfile" help:"info.json file"`
1919
Transparent bool `optional:"" short:"t" help:"Use a transparent background."`
2020
Output string `optional:"" short:"o" type:"existingdir" default:"." help:"Output directory."`
2121
}
@@ -38,6 +38,7 @@ func (g *GenerateCmd) Run() error {
3838
g.KeyboardName = strings.ReplaceAll(g.KeyboardName, "/", "_")
3939

4040
for layoutName, layout := range keyboardInfo {
41+
layout := layout
4142
ctx := createContext(&layout)
4243
err := drawLayout(ctx, g.Transparent, layout)
4344
if err != nil {

pkg/keyboard/keyboard.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package keyboard
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"os"
99
"time"
@@ -43,7 +43,7 @@ func fetch(url string) (*file, error) {
4343
Timeout: time.Second * 5, // Timeout after 2 seconds
4444
}
4545

46-
req, err := http.NewRequest(http.MethodGet, url, nil)
46+
req, err := http.NewRequest(http.MethodGet, url, http.NoBody)
4747
if err != nil {
4848
return nil, err
4949
}
@@ -59,7 +59,7 @@ func fetch(url string) (*file, error) {
5959
defer res.Body.Close()
6060
}
6161

62-
body, readErr := ioutil.ReadAll(res.Body)
62+
body, readErr := io.ReadAll(res.Body)
6363
if readErr != nil {
6464
return nil, readErr
6565
}
@@ -108,5 +108,4 @@ func LoadFile(name, path string) (Layouts, error) {
108108
}
109109
l := f.Layouts
110110
return l, nil
111-
112111
}

0 commit comments

Comments
 (0)