Walk through the most commonly used stdlib packages for real applications.

5 minbeginnergostandard-librarynet-httpencoding-json

Quick Answer

net/http provides both an HTTP client and server with no external dependency needed for basic web services. encoding/json marshals/unmarshals Go values to/from JSON, driven by struct tags. time handles durations, timestamps, timers, and tickers, and is the standard way to model timeouts and scheduling. io defines the foundational Reader/Writer interfaces that most of the standard library (files, network connections, buffers) implements, enabling generic streaming code. os covers files, environment variables, process arguments, and exit codes. os/exec runs external commands and captures their output. Together, these six packages cover the large majority of what a typical backend service needs, without reaching for a third-party dependency.

Detailed Answer

Go's standard library is unusually complete for a systems language, which is why many real Go services run with few or no third-party dependencies.

net/http: client and server, no framework required

A full HTTP server and client ship in the box:

http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintln(w, "Hello, world!")
})
http.ListenAndServe(":8080", nil)

resp, _ := http.Get("https://example.com")

encoding/json: struct-tag-driven serialization

Struct tags control field names on the way in and out:

type User struct {
    Name string `json:"name"`
    Age  int    `json:"age"`
}
b, _ := json.Marshal(User{Name: "Alice", Age: 30})
var u User
json.Unmarshal(b, &u)

time: durations, timers, and scheduling

Durations, timers, and tickers cover most scheduling needs:

deadline := time.Now().Add(5 * time.Second)
ticker := time.NewTicker(1 * time.Second)
select {
case <-ticker.C:
    fmt.Println("tick")
case <-time.After(time.Until(deadline)):
    fmt.Println("deadline reached")
}

io: the interfaces everything else builds on

Reader and Writer are the two interfaces most of the standard library is built around:

func CopyData(dst io.Writer, src io.Reader) (int64, error) {
    return io.Copy(dst, src)  // works for files, network conns, buffers — anything implementing Reader/Writer
}

os: files, environment, and process info

Files, environment variables, and command-line arguments all live here:

data, _ := os.ReadFile("config.json")
port := os.Getenv("PORT")
if len(os.Args) > 1 {
    fmt.Println("first arg:", os.Args[1])
}

os/exec: running external commands

Shelling out to another program is a single function call:

out, err := exec.Command("git", "rev-parse", "HEAD").Output()

Why this matters for interviews

Being fluent with these six packages, especially io's Reader/Writer interfaces (which show up constantly, from HTTP bodies to file handles to bytes.Buffer), signals real Go experience more than knowing any particular third-party framework, since idiomatic Go code leans on the standard library first.

Related Resources