Skip to content

Commit 0569656

Browse files
committed
Run "go fix" and "go fmt"
1 parent 81eb845 commit 0569656

19 files changed

Lines changed: 30 additions & 54 deletions

File tree

backend.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build cgo
2-
// +build cgo
32

43
package wallutils
54

backend_nocgo.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !cgo
2-
// +build !cgo
32

43
package wallutils
54

closest.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build cgo
2-
// +build cgo
32

43
package wallutils
54

closest_nocgo.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !cgo
2-
// +build !cgo
32

43
package wallutils
54

cmd/lscollection/main.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66
"path/filepath"
7+
"slices"
78
"text/tabwriter"
89

910
"github.com/urfave/cli"
@@ -12,12 +13,7 @@ import (
1213

1314
// has checks if the given string slice contains the given string
1415
func has(sl []string, s string) bool {
15-
for _, e := range sl {
16-
if e == s {
17-
return true
18-
}
19-
}
20-
return false
16+
return slices.Contains(sl, s)
2117
}
2218

2319
func listWallpaperCollectionAction(c *cli.Context) error {

cmd/setwallpaper/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func downloadDirectory() string {
113113
// Check if XDG_DOWNLOAD_DIR is defined in ~/.config/user-dirs.dirs
114114
dirfileContents, err := os.ReadFile(expanduser("~/.config/user-dirs.dirs"))
115115
if err == nil {
116-
for _, line := range strings.Split(string(dirfileContents), "\n") {
116+
for line := range strings.SplitSeq(string(dirfileContents), "\n") {
117117
if strings.HasPrefix(line, "XDG_DOWNLOAD_DIR") {
118118
elements := strings.SplitN(line, "=", 2)
119119
path = strings.TrimSpace(elements[1])

collections.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (sr *SearchResults) visit(path string, _ os.FileInfo, _ error) error {
159159
// sortWallpapers sorts the found wallpapers
160160
func (sr *SearchResults) sortWallpapers() {
161161
var collected []*Wallpaper
162-
sr.wallpapers.Range(func(_, value interface{}) bool {
162+
sr.wallpapers.Range(func(_, value any) bool {
163163
wp, ok := value.(*Wallpaper)
164164
if !ok {
165165
// internal error
@@ -181,7 +181,7 @@ func (sr *SearchResults) sortWallpapers() {
181181
// sortGnomeTimedWallpapers sorts the Found gnome Timed Wallpapers
182182
func (sr *SearchResults) sortGnomeTimedWallpapers() {
183183
var collected []*gnometimed.Wallpaper
184-
sr.gnomeWallpapers.Range(func(_, value interface{}) bool {
184+
sr.gnomeWallpapers.Range(func(_, value any) bool {
185185
gw, ok := value.(*gnometimed.Wallpaper)
186186
if !ok {
187187
// internal error
@@ -200,7 +200,7 @@ func (sr *SearchResults) sortGnomeTimedWallpapers() {
200200
// sortSimpleTimedWallpapers sorts the found Simple Timed Wallpapers
201201
func (sr *SearchResults) sortSimpleTimedWallpapers() {
202202
var collected []*simpletimed.Wallpaper
203-
sr.simpleTimedWallpapers.Range(func(_, value interface{}) bool {
203+
sr.simpleTimedWallpapers.Range(func(_, value any) bool {
204204
stw, ok := value.(*simpletimed.Wallpaper)
205205
if !ok {
206206
// internal error

pkg/event/cmd/clock/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99

1010
func clockSystem() *event.EventSys {
1111
sys := event.NewSystem(1 * time.Second)
12-
for hour := 0; hour < 24; hour++ {
13-
for minute := 0; minute < 60; minute++ {
12+
for hour := range 24 {
13+
for minute := range 60 {
1414
// Create new variables that can be closed over by the new function below
1515
hour := hour
1616
minute := minute

pkg/event/eventsys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (sys *EventSys) ClockEvent(h, m int, f func() error) {
142142

143143
// EveryMinute will trigger an event every minute for n minutes, starting from h:m
144144
func (sys *EventSys) EveryMinute(h, m, n int, f func() error) {
145-
for i := 0; i < n; i++ {
145+
for range n {
146146
sys.Register(NewClockEvent(h, m, f))
147147
m++
148148
if m >= 60 {

pkg/gnometimed/convert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func GnomeToSimpleString(gtw *Wallpaper) (string, error) {
4848

4949
// First, only gather all the image filenames
5050
var filenames []string
51-
for i := 0; i < totalElements; i++ {
51+
for i := range totalElements {
5252
// Get an element, by index. This is an interface{} and is expected to be a GStatic or a GTransition
5353
eInterface, err := gtw.Config.Get(i)
5454
if err != nil {
@@ -70,7 +70,7 @@ func GnomeToSimpleString(gtw *Wallpaper) (string, error) {
7070
sb.WriteString("format: " + commonPrefix + "%s" + commonSuffix + "\n")
7171

7272
// Then output the timing information, for static images and for transitions
73-
for i := 0; i < totalElements; i++ {
73+
for i := range totalElements {
7474
// The duration of the event is specified in the XML file, but not when it should start
7575

7676
// Get an element, by index. This is an interface{} and is expected to be a GStatic or a GTransition

0 commit comments

Comments
 (0)