vmname

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vmname names the VM of a project directory, as 0.2 did but for its prefix: the VMs it made are moved under those names (FromOld).

Index

Constants

View Source
const OldPrefix = "agent-vm-"

OldPrefix began every name 0.2 gave its VMs, in a Lima home it shared with the user's: agent-vm's own has no use for it (see FromOld).

View Source
const Template = "base"

Template is the base VM every project's VM is cloned from. No project VM has its name: theirs end with a hash.

Variables

View Source
var ErrNoDir = errors.New("no such directory")

ErrNoDir is returned by AbsDir for a directory that does not exist.

View Source
var MaxLen = 76

MaxLen is the longest name a VM may have: Lima's 76 characters, or less where its sockets would not fit under the Lima home (set from it, see vm.MaxName). Names longer are cut in their folder part (fit).

Functions

func AbsDir

func AbsDir(dir string) (string, error)

AbsDir is dir (the current directory when empty) as the commands that start a VM spell theirs: absolute, logical (symlinks kept, as `pwd` does; os.Getwd returns $PWD when it names the current directory), without "." or "..". It refuses a directory that does not exist, and a path holding a control character, which would forge lines of `info`'s key=value output.

func FromOld

func FromOld(old string) string

FromOld is the name of the VM 0.2 named old: without OldPrefix, its base template Template, cut as Name cuts a name too long here.

func IsScratch

func IsScratch(name string) bool

IsScratch reports whether name looks like one Scratch makes. It only looks like it: a project folder named "x-scratch" gets a VM named "x-scratch-<hash>", which matches. Deleting a VM unasked takes more than the name, a marker of a --scratch run (state.ScratchOf).

func Name

func Name(dir string) string

Name is the VM of the project dir, spelled as `pwd` spells it: the name hashes that string, so /tmp/ and /tmp give one VM and a symlink to the project another. <base>-<hash>, base the folder's name with every run of other characters than ASCII letters and digits made one "-" ("project" when nothing is left), and hash 8 hex digits of the path's SHA-256. On Windows, the path as Git Bash spelled it (/c/...), as 0.2 hashed it.

func Scratch

func Scratch(dir string) (string, error)

Scratch is a new name for a --scratch VM started in dir: its own, so it is never the folder's VM and several can run at once. Short enough for Lima: 76 characters, and a socket path under the Lima home of at most 104 on macOS.

Types

This section is empty.

Jump to

Keyboard shortcuts

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