fix(lint): resolve unparam warnings in doctor and rpc packages

- multirepo.go: discoverChildTypes now returns []string instead of
  ([]string, error) since error was always nil
- socket_path.go: tmpDir changed from function to const since it
  always returned "/tmp" regardless of platform

Fixes CI lint failures caused by unparam linter detecting unused
error returns and constant function results.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
This commit is contained in:
beads/crew/dave
2026-01-10 23:17:28 -08:00
committed by Steve Yegge
parent a731f5a48f
commit 40ae598751
2 changed files with 20 additions and 32 deletions

View File

@@ -7,7 +7,6 @@ import (
"encoding/hex"
"os"
"path/filepath"
"runtime"
"strings"
"github.com/steveyegge/beads/internal/utils"
@@ -54,21 +53,16 @@ func shortSocketDir(canonicalPath string) string {
hash := sha256.Sum256([]byte(canonicalPath))
hashStr := hex.EncodeToString(hash[:4]) // 8 hex chars from 4 bytes
dir := filepath.Join(tmpDir(), "beads-"+hashStr)
dir := filepath.Join(tmpDir, "beads-"+hashStr)
return filepath.Join(dir, "bd.sock")
}
// tmpDir returns the appropriate temp directory for sockets.
// On macOS, /tmp is a symlink to /private/tmp, but /tmp is shorter.
func tmpDir() string {
if runtime.GOOS == "darwin" {
// On macOS, prefer /tmp over $TMPDIR which can be long
// (/var/folders/xx/xxxxxxxxxxxx/T/)
return "/tmp"
}
// On Linux and other Unix, use /tmp
return "/tmp"
}
// tmpDir returns the temp directory for sockets.
// We always use /tmp because:
// - On macOS, $TMPDIR is very long (/var/folders/xx/xxxxxxxxxxxx/T/)
// - On Linux, /tmp is standard
// - We need short paths due to Unix socket length limits
const tmpDir = "/tmp"
// EnsureSocketDir creates the socket directory if it doesn't exist.
// Returns the socket path (unchanged) and any error.
@@ -78,7 +72,7 @@ func EnsureSocketDir(socketPath string) (string, error) {
// Only create if it's a /tmp/beads-* directory
// Don't create .beads directories - those should exist
if strings.HasPrefix(dir, filepath.Join(tmpDir(), "beads-")) {
if strings.HasPrefix(dir, filepath.Join(tmpDir, "beads-")) {
if err := os.MkdirAll(dir, 0700); err != nil {
return "", err
}
@@ -93,7 +87,7 @@ func CleanupSocketDir(socketPath string) error {
dir := filepath.Dir(socketPath)
// Only remove if it's a /tmp/beads-* directory we created
if strings.HasPrefix(dir, filepath.Join(tmpDir(), "beads-")) {
if strings.HasPrefix(dir, filepath.Join(tmpDir, "beads-")) {
// Remove socket file first
_ = os.Remove(socketPath)
// Remove directory (will fail if not empty, which is fine)