core

package
v1.7.8-553 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(p string) (string, error)

Abs returns an absolute representation of path. If the path is not absolute it is joined with the current working directory.

func Base

func Base(p string) string

Base returns the last element of path.

func Clean

func Clean(p string) string

Clean returns the shortest path equivalent to p, removing . and .. elements. All paths use forward slashes.

func Dir

func Dir(p string) string

Dir returns all but the last element of path.

func HasPathPrefix

func HasPathPrefix(path, prefixCore string) bool

HasPathPrefix checks if path starts with a special prefix. prefixCore should be "EMBED" or "STORE" (without slashes).

func IsAbsolute

func IsAbsolute(p string) bool

IsAbsolute reports whether the path is absolute. A path is absolute if it starts with "/".

func IsAbsoluteOrSpecial

func IsAbsoluteOrSpecial(p string) bool

IsAbsoluteOrSpecial reports whether the path is absolute or starts with a special prefix.

func IsInteger

func IsInteger(n float64) bool

IsInteger checks if a float64 is an integer value

func IsSpecial

func IsSpecial(p string) bool

IsSpecial reports whether the path starts with a special prefix like /EMBED/, /STORE/, /HERE/, or /CWD/.

  • /EMBED/ — embedded read-only filesystem
  • /STORE/ — datastore-backed virtual filesystem
  • /HERE/ — directory of the currently executing script frame
  • /CWD/ — process working directory

func Join

func Join(elem ...string) string

Join joins any number of path elements into a single path using forward slashes.

func Match

func Match(pattern, name string) (bool, error)

Match reports whether name matches the shell pattern. Pattern uses forward slashes and supports * and ? wildcards.

func RecoverPanic

func RecoverPanic(context string)

RecoverPanic recovers from panics in goroutines and logs them safely. It prints the panic message, stack trace, and goroutine info to stderr. This should be called at the beginning of any goroutine function:

go func() {
	defer RecoverPanic("goroutine description")
	// actual work
}()

func Rel

func Rel(basepath, targpath string) (string, error)

Rel returns a relative path that is lexicographically equivalent to targpath when joined to basepath. Returns an error if both paths cannot be made relative to each other.

func SplitList

func SplitList(s string) []string

SplitList splits a path list separated by colons (Unix-style). This is used for environment variables like DUSO_LIB. We always use colon separation internally, even on Windows.

func TrimPathPrefix

func TrimPathPrefix(path, prefixCore string) string

TrimPathPrefix removes a special prefix from path. prefixCore should be "EMBED" or "STORE" (without slashes).

Types

This section is empty.

Jump to

Keyboard shortcuts

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