CodeNebula
All paths

Idiomatic Go

Write production Go — the standard library plus generics, reflection, and advanced techniques.

0 / 27 completed0%
1

fmt — Formatted I/O

The `fmt` package implements formatted I/O. `fmt.Printf` writes formatted text t...

Go
2

errors — Error Handling Utilities

The `errors` package provides `errors.New` (create a sentinel error), `errors.Is...

Go
3

io — I/O Primitives

The `io` package defines the fundamental I/O interfaces: `io.Reader` (`Read([]by...

Go
4

os — Operating System Interface

The `os` package provides OS-level operations: file I/O, environment variables, ...

Go
5

net/http — HTTP Client and Server

`net/http` is a production-grade HTTP/1.1 and HTTP/2 library in the standard lib...

Go
6

encoding/json — JSON Marshal/Unmarshal

`encoding/json` serializes Go values to JSON (`json.Marshal`) and deserializes J...

Go
7

bufio — Buffered I/O

`bufio.Scanner` reads input line-by-line (or by custom split functions). `bufio....

Go
8

log/slog — Structured Logging (Go 1.21+)

`log/slog`, added in Go 1.21, provides structured logging with key-value pairs. ...

Go
9

testing — Unit Tests and Benchmarks

Go's built-in testing package requires no third-party dependencies. Test files e...

Go
10

strings and strconv — String Operations

The `strings` package provides string manipulation: `strings.Contains`, `strings...

Go
11

time — Time and Duration

The `time` package represents moments (`time.Time`) and durations (`time.Duratio...

Go
12

sort and slices — Sorting

The `sort` package sorts slices and user-defined collections. `sort.Ints`, `sort...

Go
13

regexp — Regular Expressions

The `regexp` package implements RE2-syntax regular expressions — a syntax with n...

Go
14

math and math/rand — Numbers

The `math` package provides floating-point constants (`math.Pi`, `math.MaxInt64`...

Go
15

flag — Command-Line Flags

The `flag` package parses command-line arguments into typed values. `flag.String...

Go
16

path/filepath — File Paths

The `path/filepath` package manipulates file paths using the operating system's ...

Go
17

Generics (Type Parameters)

Generics, introduced in Go 1.18, allow functions and types to be parameterized o...

Go
18

Reflection

The `reflect` package allows inspecting and manipulating values at runtime witho...

Go
19

Interface Composition

Go interfaces can embed other interfaces, building larger contracts from smaller...

Go
20

Build Tags and Conditional Compilation

Build tags (also called build constraints) control which files are included in a...

Go
21

unsafe Package

The `unsafe` package bypasses Go's type system and memory safety guarantees. `un...

Go
22

CGo — Calling C from Go

CGo lets Go packages call C code and be called from C. Import `"C"` (a pseudo-pa...

Go
23

Profile-Guided Optimization (PGO)

Introduced in Go 1.20 and enabled by default in 1.21, PGO optimizes compiled cod...

Go
24

go:generate — Code Generation

`//go:generate command args` is a directive that `go generate` executes. It runs...

Go
25

The Go Memory Model

The Go Memory Model specifies when a write by one goroutine is guaranteed to be ...

Go
26

Escape Analysis

Escape analysis is a compile-time pass that decides whether a value lives on the...

Go
27

Struct Tags in Depth

A struct tag is a raw string literal after a field, holding metadata read at run...

Go