返回 DeepSeek-Reasonix
helper_test.go
根目录 / internal / boot / helper_test.go
1 package boot
2
3 import (
4 "os"
5 "path/filepath"
6 "strings"
7 )
8
9 // writeFileRaw writes body to dir/name, trimming a leading newline so test
10 // literals can start on the line after the backtick. Parent directories are
11 // created so callers can write nested paths (e.g. .reasonix/skills/x.md).
12 func writeFileRaw(dir, name, body string) error {
13 full := filepath.Join(dir, name)
14 if err := os.MkdirAll(filepath.Dir(full), 0o755); err != nil {
15 return err
16 }
17 return os.WriteFile(full, []byte(strings.TrimPrefix(body, "\n")), 0o644)
18 }
19
19 lines GO