liveBook · Manning

Standard library

As explained in Learn Go with Pocket-Sized Projects

A standard library is the collection of libraries distributed with a programming language implementation.

A standard library is the collection of libraries distributed with a programming language implementation. In Go, imports that do not look like repository URLs refer to standard-library packages supplied with the compiler. These packages extend what a single Go file can do, including formatting and output through fmt. section 2.1.1

Printing from a minimal Go program

A main.go file imports fmt and calls fmt.Println("Hello world"). Running go run main.go writes Hello world to standard output; Println can also display integer and Boolean values in human-readable form. section 2.1.1

Listing 2.1 main.go
package main

import "fmt"

func main() {
    fmt.Println("Hello world")
}       

Inspect the complete main.go listing showing the package declaration, standard-library import, main function, and output call. section 2.1.1

How Learn Go with Pocket-Sized Projects covers it

How deep it goes
Defines identification through import syntax and demonstrates fmt.Println, while deferring package creation and use to later treatment.
Examples
Uses a main.go Hello world program, fmt.Println, go run main.go, and the resulting terminal output.
What it assumes
Assumes basic Go program structure and teaches import-based access to standard-library functionality through a first runnable program.
What you can do after
Apply it via Go imports to format values and write human-readable output to standard output.
How it connects
Connects packages, imports, third-party libraries, fmt, standard output, and the main function.

Also explained in

Compare how 7 books explain standard library →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Go with Pocket-Sized Projects. The section links point to the parts of the book it draws on.