refactor: use slog instead of log
Some checks are pending
Go CI Pipeline / ci (push) Waiting to run
Release Builds / GoReleaser build (push) Successful in 1m4s

This commit is contained in:
Patryk Hegenberg 2025-06-11 22:41:48 +02:00
parent fcffccc145
commit d8743e54c1
8 changed files with 180 additions and 165 deletions

View file

@ -2,7 +2,7 @@ package main
import (
"fmt"
"log"
"log/slog"
"os"
"path/filepath"
@ -43,7 +43,7 @@ func loadConfig() (Config, error) {
workConfigPath := filepath.Join(configPath, "work")
configFile := filepath.Join(workConfigPath, "config.toml")
if err := os.MkdirAll(workConfigPath, 0750); err != nil {
if err := os.MkdirAll(workConfigPath, 0o750); err != nil {
return cfg, fmt.Errorf("could not create config directory '%s': %w", workConfigPath, err)
}
@ -55,7 +55,7 @@ func loadConfig() (Config, error) {
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
return cfg, fmt.Errorf("error reading config file '%s': %w", configFile, err)
}
log.Printf("INFO: Config file '%s' not found, using defaults/env vars.", configFile)
slog.Info(fmt.Sprintf("Config file '%s' not found, using defaults/env vars.", configFile))
}
if err := viper.UnmarshalKey("default", &cfg); err != nil {