Skip to content

Commit 77d9326

Browse files
committed
Explicitly omit unwanted errors
1 parent e765fd7 commit 77d9326

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

deck.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (d *Deck) loadBackground(dev *streamdeck.Device, bg string) error {
7777
if err != nil {
7878
return err
7979
}
80-
defer f.Close()
80+
defer f.Close() //nolint:errcheck
8181

8282
background, _, err := image.Decode(f)
8383
if err != nil {
@@ -152,10 +152,10 @@ func emulateKeyPress(keys string) {
152152
}
153153

154154
if i+1 < len(kk) {
155-
keyboard.KeyDown(kc)
156-
defer keyboard.KeyUp(kc)
155+
_ = keyboard.KeyDown(kc)
156+
defer keyboard.KeyUp(kc) //nolint:errcheck
157157
} else {
158-
keyboard.KeyPress(kc)
158+
_ = keyboard.KeyPress(kc)
159159
}
160160
}
161161
}

desktop_unix.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ type Window struct {
4747
Icon image.Image
4848
}
4949

50-
var (
51-
ErrNoValue = errors.New("empty value")
52-
ErrNoClass = errors.New("empty class")
53-
)
54-
5550
// Connect establishes a connection with an Xorg display.
5651
func Connect(display string) (*Xorg, error) {
5752
var x Xorg
@@ -189,7 +184,7 @@ func (x Xorg) name(w xproto.Window) (string, error) {
189184
return "", err
190185
}
191186
if string(name.Value) == "" {
192-
return "", ErrNoValue
187+
return "", errors.New("empty value")
193188
}
194189
}
195190
return string(name.Value), nil
@@ -215,7 +210,7 @@ func (x Xorg) class(w xproto.Window) (string, error) {
215210
if l := len(s); l > 0 && len(s[l-1]) != 0 {
216211
return string(s[l-1]), nil
217212
}
218-
return "", ErrNoClass
213+
return "", errors.New("empty class")
219214
}
220215

221216
func (x Xorg) window() (Window, bool) {

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func main() {
126126
log.Printf("Could not create virtual input device (/dev/uinput): %s", err)
127127
log.Println("Emulating keyboard events will be disabled!")
128128
} else {
129-
defer keyboard.Close()
129+
defer keyboard.Close() //nolint:errcheck
130130
}
131131

132132
var keyStates sync.Map

widget.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func drawImage(img *image.RGBA, path string, size int, pt image.Point) error {
152152
if err != nil {
153153
return err
154154
}
155-
defer f.Close()
155+
defer f.Close() //nolint:errcheck
156156

157157
icon, _, err := image.Decode(f)
158158
if err != nil {
@@ -169,7 +169,8 @@ func drawImage(img *image.RGBA, path string, size int, pt image.Point) error {
169169
}
170170

171171
icon = resize.Resize(uint(size), uint(size), icon, resize.Bilinear)
172-
draw.Draw(img, image.Rect(pt.X, pt.Y, pt.X+size, pt.Y+size), icon, image.Point{0, 0}, draw.Src)
172+
rect := image.Rect(pt.X, pt.Y, pt.X+size, pt.Y+size)
173+
draw.Draw(img, rect, icon, image.Point{0, 0}, draw.Src)
173174

174175
return nil
175176
}

widget_recent_window.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ func (w *RecentWindowWidget) TriggerAction() {
4343
}
4444

4545
if int(w.window) < len(recentWindows) {
46-
xorg.RequestActivation(recentWindows[w.window])
46+
_ = xorg.RequestActivation(recentWindows[w.window])
4747
}
4848
}

0 commit comments

Comments
 (0)