Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2612d660dd | ||
|
|
795e1348b8 | ||
|
|
c967727ff8 | ||
|
|
17ab9d05e7 | ||
|
|
2e167f0bd1 | ||
|
|
eb14182aa3 |
@@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
run: |
|
run: |
|
||||||
curl -sSL https://go.dev/dl/go1.24.1.linux-amd64.tar.gz -o /tmp/go.tar.gz
|
curl -sSL https://go.dev/dl/go1.24.13.linux-amd64.tar.gz -o /tmp/go.tar.gz
|
||||||
tar -C /usr/local -xzf /tmp/go.tar.gz
|
tar -C /usr/local -xzf /tmp/go.tar.gz
|
||||||
echo "/usr/local/go/bin" >> $GITHUB_PATH
|
echo "/usr/local/go/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
run: |
|
run: |
|
||||||
curl -sSL https://go.dev/dl/go1.24.1.linux-amd64.tar.gz -o /tmp/go.tar.gz
|
curl -sSL https://go.dev/dl/go1.24.13.linux-amd64.tar.gz -o /tmp/go.tar.gz
|
||||||
tar -C /usr/local -xzf /tmp/go.tar.gz
|
tar -C /usr/local -xzf /tmp/go.tar.gz
|
||||||
echo "/usr/local/go/bin" >> $GITHUB_PATH
|
echo "/usr/local/go/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
run: |
|
run: |
|
||||||
curl -sSL https://go.dev/dl/go1.24.1.linux-amd64.tar.gz -o /tmp/go.tar.gz
|
curl -sSL https://go.dev/dl/go1.24.13.linux-amd64.tar.gz -o /tmp/go.tar.gz
|
||||||
tar -C /usr/local -xzf /tmp/go.tar.gz
|
tar -C /usr/local -xzf /tmp/go.tar.gz
|
||||||
echo "/usr/local/go/bin" >> $GITHUB_PATH
|
echo "/usr/local/go/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,32 @@ linters:
|
|||||||
- ineffassign
|
- ineffassign
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- unused
|
- unused
|
||||||
|
exclusions:
|
||||||
issues:
|
presets:
|
||||||
exclude-dirs:
|
- std-error-handling
|
||||||
- cmd/panel
|
rules:
|
||||||
- cmd/icongen
|
# binary.Write in ICO header encoding — panic-level errors only
|
||||||
|
- path: internal/icons/render\.go
|
||||||
|
linters: [errcheck, gosec]
|
||||||
|
source: "binary\\.Write"
|
||||||
|
# systray ShowMenu return value is meaningless
|
||||||
|
- path: internal/tray/
|
||||||
|
linters: [errcheck, gosec]
|
||||||
|
source: "ShowMenu"
|
||||||
|
# Config files use 0755/0644 intentionally (user-readable config, not secrets)
|
||||||
|
- linters: [gosec]
|
||||||
|
text: "G301|G306"
|
||||||
|
path: internal/config/
|
||||||
|
# Process manager and panel launcher must exec with variable paths
|
||||||
|
- linters: [gosec]
|
||||||
|
text: "G204"
|
||||||
|
# API key display string is not a hardcoded credential
|
||||||
|
- linters: [gosec]
|
||||||
|
text: "G101"
|
||||||
|
path: internal/tray/
|
||||||
|
# Setup binary is a CLI wizard; best-effort error handling is acceptable
|
||||||
|
- path: cmd/setup/
|
||||||
|
linters: [errcheck, gosec]
|
||||||
|
paths:
|
||||||
|
- cmd/panel
|
||||||
|
- cmd/icongen
|
||||||
|
|||||||
@@ -53,10 +53,7 @@ var defaults = Config{
|
|||||||
LastEventID: 0,
|
LastEventID: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var mu sync.Mutex
|
||||||
mu sync.Mutex
|
|
||||||
cached *Config
|
|
||||||
)
|
|
||||||
|
|
||||||
// Load reads config from disk, merging with defaults.
|
// Load reads config from disk, merging with defaults.
|
||||||
func Load() Config {
|
func Load() Config {
|
||||||
@@ -71,7 +68,7 @@ func Load() Config {
|
|||||||
if err := json.Unmarshal(data, &cfg); err != nil {
|
if err := json.Unmarshal(data, &cfg); err != nil {
|
||||||
log.Printf("config: parse error: %v", err)
|
log.Printf("config: parse error: %v", err)
|
||||||
}
|
}
|
||||||
cached = &cfg
|
|
||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +85,7 @@ func Save(cfg Config) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cached = &cfg
|
|
||||||
return os.WriteFile(ConfigPath(), data, 0o644)
|
return os.WriteFile(ConfigPath(), data, 0o644)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,6 @@ func TestSaveLoadRoundTrip(t *testing.T) {
|
|||||||
t.Fatalf("Save failed: %v", err)
|
t.Fatalf("Save failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear cache so Load reads from disk
|
|
||||||
mu.Lock()
|
|
||||||
cached = nil
|
|
||||||
mu.Unlock()
|
|
||||||
|
|
||||||
loaded := Load()
|
loaded := Load()
|
||||||
if loaded.SyncthingAPIKey != "test-key-12345" {
|
if loaded.SyncthingAPIKey != "test-key-12345" {
|
||||||
t.Errorf("API key not round-tripped: got %q", loaded.SyncthingAPIKey)
|
t.Errorf("API key not round-tripped: got %q", loaded.SyncthingAPIKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user