platformdir

package
v0.1.96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package platformdir resolves the OS-conventional per-user directories for GoModel's durable data and caches, used when no explicit path is configured. Binary installs (install.sh / Homebrew / install.ps1) run from arbitrary working directories, so CWD-relative defaults would scatter state; these follow each platform's convention instead.

Index

Constants

View Source
const LocalDataDir = "data"

LocalDataDir is the project-local data directory. Deployments that already have one — the Docker image, anyone running from a checkout — keep their state there, so upgrades never move a database or a pid file out from under an operator.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() (string, error)

CacheDir returns the directory for re-creatable caches such as the model catalog:

Linux    $XDG_CACHE_HOME/gomodel (default ~/.cache/gomodel)
macOS    ~/Library/Caches/gomodel
Windows  %LocalAppData%\gomodel\cache

func DataDir

func DataDir() (string, error)

DataDir returns the directory for durable application data such as the SQLite database:

Linux    $XDG_DATA_HOME/gomodel (default ~/.local/share/gomodel)
macOS    ~/Library/Application Support/gomodel
Windows  %LocalAppData%\gomodel

func DataFile added in v0.1.68

func DataFile(name string) string

DataFile returns where a durable data file called name belongs: inside LocalDataDir when that directory exists next to the process, otherwise inside DataDir. Callers share this rule so a deployment's files stay together instead of some landing project-local and others in the per-user directory.

The local form is spelled with a forward slash on every platform, which Windows accepts, so it stays comparable to the legacy path constants built the same way.

func Ephemeral added in v0.1.85

func Ephemeral(dir string) bool

Ephemeral reports whether dir lives on a filesystem that does not outlive the running container: the image's overlay layer, or a tmpfs. A directory on a mounted volume, a bind mount, or any ordinary disk reports false, and so does every platform without Linux mount tables.

It exists so a deployment that keeps its database or its identity in such a directory can be told at startup, before the data is lost, rather than after.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL