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:
@@ -5,6 +5,7 @@
|
||||
```bash
|
||||
mise trust # trust the mise.toml config (first time only)
|
||||
mise install # installs go 1.26, node 22
|
||||
mise run gopls # install gopls (Go LSP) — one-time dev setup
|
||||
```
|
||||
|
||||
All build/run tasks are defined in `mise.toml`:
|
||||
|
||||
@@ -250,7 +250,9 @@ func cmdDownload(args []string) {
|
||||
jobs := fs.Int("jobs", 2, "concurrent downloads")
|
||||
_ = fs.Parse(args)
|
||||
|
||||
os.MkdirAll(*outDir, 0755)
|
||||
if err := os.MkdirAll(*outDir, 0755); err != nil {
|
||||
fatal("create %s: %v", *outDir, err)
|
||||
}
|
||||
|
||||
var identifiers []string
|
||||
if *identifier != "" {
|
||||
@@ -383,7 +385,9 @@ func cmdExtract(args []string) {
|
||||
jobs := fs.Int("jobs", 2, "concurrent extractions")
|
||||
_ = fs.Parse(args)
|
||||
|
||||
os.MkdirAll(*outDir, 0755)
|
||||
if err := os.MkdirAll(*outDir, 0755); err != nil {
|
||||
fatal("create %s: %v", *outDir, err)
|
||||
}
|
||||
|
||||
entries, err := os.ReadDir(*isoDir)
|
||||
if err != nil {
|
||||
|
||||
@@ -20,3 +20,4 @@ docker-build = "docker build -t akai-fetch ."
|
||||
check-toolchain = "bash scripts/check-toolchain.sh"
|
||||
check-docker-toolchain = "bash scripts/check-docker-toolchain.sh"
|
||||
check-all = { run = "bash scripts/check-toolchain.sh && echo '' && bash scripts/check-docker-toolchain.sh" }
|
||||
gopls = "go install golang.org/x/tools/gopls@latest"
|
||||
|
||||
@@ -98,6 +98,19 @@ fi
|
||||
|
||||
echo ""
|
||||
|
||||
# ─── gopls (Go LSP) ────────────────────────────────────────────────────
|
||||
echo "gopls (Go language server):"
|
||||
if command -v gopls &>/dev/null; then
|
||||
gopls_ver=$(gopls version 2>/dev/null)
|
||||
ok "gopls found: $gopls_ver"
|
||||
else
|
||||
warn "gopls not found (recommended for IDE support)"
|
||||
echo " Install: go install golang.org/x/tools/gopls@latest"
|
||||
echo " (ensure $(go env GOPATH)/bin is in PATH)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# ─── Node ──────────────────────────────────────────────────────────────
|
||||
echo "Node:"
|
||||
if command -v node &>/dev/null; then
|
||||
|
||||
@@ -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