Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
p-mng committed Jan 1, 2025
1 parent b35c71d commit 8313ba2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
linters:
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- goconst
- gocritic
- gosec
- nilnil
- revive
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func ReadConfig() (*Config, error) {
return nil, err
}

err = os.WriteFile(fileName, defaultMarshalled, 0644)
err = os.WriteFile(fileName, defaultMarshalled, 0600)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import (
func main() {
conn, err := dbus.ConnectSessionBus()
if err != nil {
log.Fatalf("failed to connect to session bus: %v", err)
log.Printf("failed to connect to session bus: %v", err)
return
}
defer conn.Close()

config, err := ReadConfig()
if err != nil {
log.Fatalf("error reading config: %v", err)
log.Printf("error reading config: %v", err)
return
}

RunMainLoop(conn, config)
Expand Down
6 changes: 2 additions & 4 deletions mpris.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ func getProperty[E any](obj dbus.BusObject, property string) (*E, error) {

if parsedValue, ok := value.Value().(E); ok {
return &parsedValue, nil
} else {
return nil, errors.New("failed to read property from DBus object")
}
return nil, errors.New("failed to read property from DBus object")
}

func getMapEntry[E any](metadata map[string]dbus.Variant, key string) (*E, error) {
Expand All @@ -106,7 +105,6 @@ func getMapEntry[E any](metadata map[string]dbus.Variant, key string) (*E, error

if parsedValue, ok := value.Value().(E); ok {
return &parsedValue, nil
} else {
return nil, fmt.Errorf("invalid data type for map entry %s", key)
}
return nil, fmt.Errorf("invalid data type for map entry %s", key)
}
2 changes: 1 addition & 1 deletion provider_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"
)

func (f *FileConfig) NowPlaying(n NowPlaying) {
func (f *FileConfig) NowPlaying(_ NowPlaying) {

}

Expand Down

0 comments on commit 8313ba2

Please sign in to comment.