Standard library / os

os.Stdout

Initially wraps standard output. It can be a terminal, file or pipe; writes can fail. The example writes directly to the standard stream. Example intended for Linux/AMD64 with Go 1.23.2 in a disposable working directory; other platforms may differ. Expected stdout: 'hello\n'.

Formal Syntax & Structure

go syntaxgo
var Stdout *File

Working Example

Example Snippetgo
package main
import (  "os")
func must(e error) {  if e != nil {    panic(e)  }}func main() { _, e := os.Stdout.WriteString("hello\n"); must(e) }
Go Reference