Articles by Antony Shikubu
Go Channels Tutorial: Send, Receive, Close, Range, and Select
Learn channels in Go, including send and receive syntax, buffered and unbuffered channels, close, range, select, deadlocks, and common concurrency patterns.
Golang Pointers Tutorial: Address, Dereference, nil, and Pointer Receivers
Learn pointers in Go: pointer types *T, address operator &, dereferencing, nil pointers, passing pointers to functions, pointer receivers, structs, slices and maps, and when not to use pointers.
Golang Interface Tutorial: Examples, Implementation, and Type Assertion
Learn interfaces in Go with simple examples, including method sets, implicit implementation, interface parameters, empty interface, any, type assertion, printing interface values, composition, pointer receivers, and …
Golang WaitGroup: sync.WaitGroup Example, Add, Done, and Wait
Learn how to use sync.WaitGroup in Go to wait for goroutines, with Add, Done, Wait, WaitGroup.Go, common mistakes, and practical examples.
Golang Channel with Multiple Receivers: Workers, Fan-Out, and Safe Closing
Learn how multiple goroutines read from the same Go channel: each value is received once, fan-out worker pools, closing rules, result channels, buffered vs unbuffered, and why this is not broadcast.
Golang functions: syntax, parameters, returns, methods, closures, and defer
Golang function guide: overview, syntax and naming, declaring and calling, single and multiple returns, errors and pointers, pass by value vs pointer, struct map slice channel, variadic pointer to variadic article, …
Golang Fan-Out Fan-In Pattern: Goroutines, Channels, and Worker Pools
Learn the fan-out fan-in pattern in Go with goroutines and channels: distribute work, merge results, relate it to worker pools, handle errors and cancellation, preserve ordering when needed, and close channels safely.
Golang Trim String: Remove Whitespace, Prefix, and Suffix
Trim strings in Go with strings.TrimSpace, strings.Trim, TrimPrefix, and TrimSuffix to remove whitespace, cutset characters, and exact prefixes or suffixes.
Golang methods: receivers, struct methods, and interfaces
Golang method and go methods: value vs pointer receivers, golang struct methods and calls, methods on defined types, method sets and interfaces; same-package rules and when Go adjusts & for you.
Enums in Go with iota, named types, and String()
Model a golang enum as a named integer type with const iota values, optional String and fmt.Stringer, validation helpers, and JSON encode or decode via maps or custom MarshalJSON when strings cross APIs.
Smaller Go Docker images with multi-stage builds
Shrink a Go service image with Docker multi-stage builds: compile in a golang image, then copy only the static binary into a minimal runtime such as Alpine so the final image stays small for deploy and bandwidth.
Go defer keyword: LIFO cleanup, evaluation rules, and loops
Use golang defer to schedule a function call when the surrounding function returns; arguments are evaluated immediately; multiple defers run in LIFO order; avoid defer in tight loops without an inner function.
Golang map and map literal: basics, global maps, and iteration
Golang map and maps in golang: map[K]V, golang map literal and make, nil map panic, comma-ok lookup, delete and range, ordered iteration via sorted keys, golang global map and concurrency, dictionary analogy to Python.
Logrus for Go: golang logrus, levels, JSON, files, and hooks
Golang logrus and go logrus: install github.com/sirupsen/logrus, logrus log levels with SetLevel, TextFormatter and JSONFormatter, io.MultiWriter, SetReportCaller, hooks, and how long go.sum lines relate to the module …
Golang for loop and `for range`: slices, maps, structs, interfaces, channels
Golang for loop and go for loop guide: for loop in golang syntax, golang for cycle with three-part and while-style loops, for range over slices, maps, strings, golang iterate struct fields with reflect, golang iterate …
Use Go as a Redis Client (go-redis, Ping, Get, Set, Hashes)
Connect a Go program to Redis with github.com/redis/go-redis/v9, Ping with context, Set and Get strings, and store hashes; run Redis locally and match password and DB settings.
Golang gRPC tutorial: server, client, and Protocol Buffers example
Golang grpc example and grpc golang tutorial: proto3 service, golang grpc server and grpc server golang with Register and Serve, go grpc client and go grpc example with grpc.NewClient and transport credentials, grpc go …
Golang flag package examples: CLI flags, multiple values, subcommands
Golang flag and golang flags examples using the standard library flag package: go flag and go CLI flags, golang flag example for string, int, and bool, golang flag multiple values with flag.Value, required flags, …
Golang break and continue: inner loop, outer loop, and select
Golang break and golang continue for go break loop and golang break for loop; golang break outer loop and golang continue outer loop with labels; golang select break exits the select—use a label to leave the surrounding …
Golang Fiber CRUD API tutorial: routes, JSON, and Postman
Go fiber tutorial and golang fiber CRUD REST demo: fiber golang routing, fiber routes API with grouped paths, JSON handlers with Fiber, in-memory articles, Postman screenshots—practical codebase for fiber go and fiber …
Golang FIFO and named pipes: mkfifo, syscall.Mkfifo, EOF, open modes
Golang fifo and golang mkfifo: create fifo files with syscall.Mkfifo or mkfifo command in linux, golang named pipe reader and writer, O_RDONLY vs O_RDWR and EOF handling—linux fifo example and go fifo inter-process …
Go environment variables: getenv, setenv, lookup, go env, and .env files
Go environment variables and golang environment variables: golang get environment variable with LookupEnv, golang set environment variable with Setenv, go env vs process env (golang env, go env variables), env golang and …
Golang mutex: sync.Mutex lock and unlock with examples
Mutex in golang with sync.Mutex: Lock and Unlock, fix data races with go run -race, golang mutex lock patterns, defer unlock, sync.RWMutex for many readers, embed a mutex in a struct.
Golang global variables: package scope, exports, structs, and pitfalls
Golang global variable and golang global variables: package-level var, global variable declaration golang, golang globals and go global variables, golang global variables across packages with exported names, global …
Gorilla mux in Go: routing, path variables, subrouters, and middleware
Gorilla mux tutorial for gorilla mux and golang gorilla mux: install github.com/gorilla/mux, gorilla mux example with Methods and path vars, subrouters, middleware with r.Use, mux gorilla naming, and gorilla mux vs gin …
Go comma ok idiom: map, type assertion, and channel receive
Golang comma ok idiom and go comma ok idiom: the second bool from v, ok := m[k], v, ok := x.(T), or v, ok := <-ch; comma ok idiom golang covers maps, type assertions, and closed channels—not the same as if err != nil.
Change the Default log Package Prefix, Flags, and Output in Go
Go import log for the standard logger: change golang log format with SetFlags, add a golang log prefix with SetPrefix or log.New, use log.Printf for formatted lines, and send output to files or MultiWriter for console …
Golang goroutines: go routine examples, the go keyword, and waiting for work
Golang goroutine and golang goroutines: goroutine in golang with the go keyword, go goroutines and go routine spelling, minimal goroutine example, waiting with channels or sync.WaitGroup, and links to threads vs …
Golang Zap logger: Logger vs SugaredLogger, levels, and request IDs
Zap logger and zap logging with go.uber.org/zap, zap sugaredlogger and sugaredlogger vs Logger, golang zap and zap golang structured fields, zap request id with With or Infow, golang zap logger setup, levels, and …
Golang Write to File, Append & Create File (os.WriteFile, OpenFile Examples)
Learn how to write, append, and create files in Golang using os.WriteFile and os.OpenFile. This practical guide covers file writing, appending data, creating files if not exists, flags explanation, real-world examples, …

