os package

Go's standard library package for talking to the operating system: arguments, environment variables, files and the exit code.

In more detail

Its functions work the same on Linux, macOS and Windows. os.Stdout and os.Stderr are the standard output and error streams as files you can write to. Most command-line tools need little beyond os, fmt and flag.

Example

fmt.Fprintln(os.Stderr, "usage: probe <host>")

Related terms

Taught in

References