Skip to content

Commit

Permalink
style(linter): fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMarble committed Jan 15, 2023
1 parent 640fa66 commit 9b500e7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/zmk-viewer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func (d debugFlag) BeforeApply() error {
return nil
}

func (v VersionFlag) Decode(ctx *kong.DecodeContext) error { return nil }
func (v VersionFlag) IsBool() bool { return true }
func (v VersionFlag) Decode(_ *kong.DecodeContext) error { return nil }
func (v VersionFlag) IsBool() bool { return true }
func (v VersionFlag) BeforeApply(app *kong.Kong) error {
fmt.Printf("zmk-viewer has version %s built from %s on %s\n", version, commit, date)
app.Exit(0)
Expand Down
4 changes: 2 additions & 2 deletions internal/lib/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ func drawBehavior(ctx *gg.Context, key *keymap.Behavior, x float64, y float64) {
for i, v := range key.Params {
str := ""
if v.KeyCode == nil {
str = str + fmt.Sprintf("%v", *v.Number)
str += fmt.Sprintf("%v", *v.Number)
} else {
str = str + *v.KeyCode
str += *v.KeyCode
}

dw, dh := ctx.MeasureString(str)
Expand Down
3 changes: 2 additions & 1 deletion internal/lib/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type GenerateCmd struct {
KeyboardName string `arg:"" help:"Keyboard name to fetch layout."`

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

for layoutName, layout := range keyboardInfo {
layout := layout
ctx := createContext(&layout)
err := drawLayout(ctx, g.Transparent, layout)
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/keyboard/keyboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package keyboard
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"time"
Expand Down Expand Up @@ -43,7 +43,7 @@ func fetch(url string) (*file, error) {
Timeout: time.Second * 5, // Timeout after 2 seconds
}

req, err := http.NewRequest(http.MethodGet, url, nil)
req, err := http.NewRequest(http.MethodGet, url, http.NoBody)
if err != nil {
return nil, err
}
Expand All @@ -59,7 +59,7 @@ func fetch(url string) (*file, error) {
defer res.Body.Close()
}

body, readErr := ioutil.ReadAll(res.Body)
body, readErr := io.ReadAll(res.Body)
if readErr != nil {
return nil, readErr
}
Expand Down Expand Up @@ -108,5 +108,4 @@ func LoadFile(name, path string) (Layouts, error) {
}
l := f.Layouts
return l, nil

}

0 comments on commit 9b500e7

Please sign in to comment.