fix: check MkdirAll errors, add gopls to toolchain

- serve.go/cmdAPIDownload: check MkdirAll error, use absolute path
- main.go/cmdDownload,cmdExtract: check MkdirAll errors
- check-toolchain.sh: verify gopls installation
- mise.toml: add gopls install task
- AGENTS.md: document gopls as dev dependency
This commit is contained in:
2026-06-21 22:27:17 -07:00
parent ea2bcde74b
commit 15979d01b5
5 changed files with 30 additions and 7 deletions
+7 -3
View File
@@ -158,7 +158,13 @@ func handleAPIDownload(w http.ResponseWriter, r *http.Request) {
outDir = "."
}
os.MkdirAll(outDir, 0755)
if abs, err := filepath.Abs(outDir); err == nil {
outDir = abs
}
if err := os.MkdirAll(outDir, 0755); err != nil {
writeJSON(w, map[string]any{"error": fmt.Sprintf("create %s: %v", outDir, err)})
return
}
files := getItemFiles(identifier)
if len(files) == 0 {
@@ -287,8 +293,6 @@ func handleAPIExtract(w http.ResponseWriter, r *http.Request) {
outDir = "./wavs"
}
os.MkdirAll(outDir, 0755)
entries, err := os.ReadDir(isoDir)
if err != nil {
writeJSON(w, map[string]any{"error": err.Error()})