requireAbsolutePath rejects relative paths; relative paths would depend on the process cwd and defeat the point of a static audit. Shell-style shortcuts like `~` are home-relative, not cwd-relative — they are an orthogonal concern and the audit is intentionally Go-stdlib strict here. Callers that ac
(target, label string)
| 71 | // Callers that accept user-authored config (e.g. resolveFileRef) must |
| 72 | // pre-resolve any such shortcuts before passing the path in. |
| 73 | func requireAbsolutePath(target, label string) error { |
| 74 | if !filepath.IsAbs(target) { |
| 75 | return fmt.Errorf("%s: path must be absolute, got %q", label, target) |
| 76 | } |
| 77 | return nil |
| 78 | } |
| 79 | |
| 80 | // lstatNonDir stats the path without following symlinks, rejecting |
| 81 | // directories. Returns the stat info for downstream steps to reuse. |