Simplify Go installation and support standard OpenCode releases

This commit is contained in:
2026-10-08 23:17:38 +01:00
parent 0f30a001c2
commit accbe63e39
101 changed files with 1331 additions and 682 deletions
+21
View File
@@ -0,0 +1,21 @@
// Package paths centralizes standard user locations; callers can override them.
package paths
import (
"os"
"path/filepath"
"runtime"
)
func Data() (string, error) {
if dir := os.Getenv("XDG_DATA_HOME"); dir != "" {
return filepath.Abs(filepath.Join(dir, "pipelines"))
}
if runtime.GOOS == "darwin" || runtime.GOOS == "windows" {
dir, err := os.UserConfigDir()
return filepath.Join(dir, "pipelines"), err
}
home, err := os.UserHomeDir()
return filepath.Join(home, ".local", "share", "pipelines"), err
}
func Database() (string, error) { dir, err := Data(); return filepath.Join(dir, "pipelines.db"), err }
+15
View File
@@ -0,0 +1,15 @@
package paths
import (
"path/filepath"
"testing"
)
func TestDataLocationIsIndependentOfExecutable(t *testing.T) {
dir := t.TempDir()
t.Setenv("XDG_DATA_HOME", dir)
db, err := Database()
if err != nil || db != filepath.Join(dir, "pipelines", "pipelines.db") {
t.Fatal(db, err)
}
}