mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 00:26:29 +00:00
style(example-dlna-server): satisfy golangci-lint (nilerr, revive)
Two lint fixes on the DLNA test server, no behaviour change: - nilerr: the "skip unreadable file, keep walking" branch in the --media-dir WalkDir callback returns nil after a non-nil read error by design; annotate it with //nolint:nilerr, matching the existing skip-entry branch above it. - revive (redefines-builtin-id): rename between()'s `close` parameter (and `open` for symmetry) to closeTag/openTag so it no longer shadows the builtin `close`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
5103f459bf
commit
841a9047e2
@@ -91,6 +91,7 @@ func main() {
|
||||
}
|
||||
|
||||
opts = append(opts, dlnatest.WithTree(tree))
|
||||
|
||||
logger.Info("serving real media from directory", "dir", *mediaDir, "tracks", n)
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ func loadTreeFromDir(dir, fallbackName string) (*dlnatest.Tree, int, error) {
|
||||
|
||||
payload, rerr := os.ReadFile(path)
|
||||
if rerr != nil {
|
||||
return nil // skip unreadable file
|
||||
return nil //nolint:nilerr // skip unreadable file, keep walking
|
||||
}
|
||||
|
||||
trackDir := filepath.Dir(path)
|
||||
@@ -675,17 +676,17 @@ func withAccessLog(logger *slog.Logger, next http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
// between returns the text between the first occurrence of open and the next
|
||||
// close, or "" if not found. Used for lightweight SOAP field extraction in logs.
|
||||
func between(s, open, close string) string {
|
||||
i := strings.Index(s, open)
|
||||
// between returns the text between the first occurrence of openTag and the next
|
||||
// closeTag, or "" if not found. Used for lightweight SOAP field extraction in logs.
|
||||
func between(s, openTag, closeTag string) string {
|
||||
i := strings.Index(s, openTag)
|
||||
if i < 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
i += len(open)
|
||||
i += len(openTag)
|
||||
|
||||
j := strings.Index(s[i:], close)
|
||||
j := strings.Index(s[i:], closeTag)
|
||||
if j < 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user