Skip to content

Glossary: Go Basics

os.Open and os.Create

Also written: os.Open, os.Create, *os.File

`os.Open` opens a file for reading, and `os.Create` opens one for writing, creating it or emptying it first. Both return a file and an error, and the file must be closed afterwards.

Where the book teaches it

Related terms

deferos.ReadFile and os.WriteFile