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:
@@ -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()})
|
||||
|
||||
Reference in New Issue
Block a user