Documentation ¶
Overview ¶
Package os provides Goal's default IO/OS builtins.
Use the Import function to register the variadic functions provided by this package.
Various variadic functions automatically work on new goal.BV value types as long as they satisfy the relevant interface:
io.Reader: read io.Writer: print,say io.Closer: close fs.FS: all builtins accepting a file system value left interface{ Flush() error }: flush interface{ Stat() (fs.FileInfo, error) }: stat
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Import ¶ added in v0.39.0
Import registers in the given Context all the core Goal IO variadic functions as verbs with default names and valence. It also assigns command-line arguments and standard filehandles to globals.
If the given prefix string is not empty, it is used as a common dot prefix for names. Note, however, that the cmd/goal interpreter and library files in lib/ are designed to work together with an empty prefix.
Monads: abspath chdir close dirfs flush mkdir remove
Dyads: env glob import open print read rename run say shell stat subfs
Globals: ARGS STDIN STDOUT STDERR
Note that subfs comes from the io/fs package, but is registered for convenience by this function.
func NewFileReader ¶ added in v0.25.0
NewFileReader returns a reader handle for the given file. It may be buffered for non-directory files if enabled. It assumes the file has been opened in read mode.
func NewFileWriter ¶ added in v0.25.0
NewFileWriter returns a writer handle for the given file, using buffering if enabled. It assumes the file has been opened in write or append mode.
func NewOSError ¶ added in v1.0.0
NewOSError converts an operating-system Go error to a Goal error dict value with fields as described in the FAQ.
func NewStringReader ¶ added in v1.0.0
NewStringReader returns a string reader handle Goal value for the given string.
func NewStringWriter ¶ added in v1.0.0
NewStringWriter returns a string writer handle Goal value, with initial buffer of size i.
Types ¶
This section is empty.