Blog

Latest Articles

Browse the latest tutorials, guides, and practical examples across Linux, DevOps, security, databases, and programming on GoLinuxCloud.

Explore the latest tutorials and guides across Linux, DevOps, programming, and more.

You can also browse content by category below:

  • Linux: Commands, administration, troubleshooting, and system operations
  • DevOps: CI/CD, Kubernetes, containers, and automation
  • Cloud: AWS, Azure, OpenStack, and hybrid cloud administration
  • Programming: Coding tutorials, scripting, and development concepts
  • Security: Ethical hacking, system security, and best practices
  • Databases: MySQL, MariaDB, PostgreSQL, and database management
  • Networking: Network setup, troubleshooting, and protocols
  • Storage: Disk management, file systems, and storage solutions
  • Tools: Useful tools and utilities for productivity

2329 articles

Blog illustration with latest articles, tutorials, guides, and how-to content across Linux and DevOps topics
programming

Golang log to file, stdout, and syslog with the standard log package

Golang log to file with os.OpenFile and log.SetOutput; golang log to file and stdout using io.MultiWriter; golang log syslog on Linux; go import log and golang log example; concurrency-safe default log.Logger.

Tuan Nguyen3 min read
programming

Go functions with multiple types: `any`, type switches, and generics

Golang function parameter multiple types: use any/interface{} with a type switch, golang function types with type parameters (generics), go function types and golang func type constraints, plus golang pass type as …

Tuan Nguyen4 min read
programming

Call a Function From Another Package or File in Go

Call Go code from another file or another package: what to import, when you do not need an import, capital letters for public functions, and how to fix typical errors.

Deepak Prasad7 min read
programming

go list installed packages: list Go packages, modules, and install paths

go list command for std, ./..., and all; go list -m all for modules; where Go stores packages (GOMODCACHE, GOROOT, GOPATH/bin); list go packages and binaries from go install without mistaking modules for a global package …

Deepak Prasad4 min read
programming

Golang Anonymous Function Explained with Examples

Learn anonymous functions in Go: function literals, immediate calls, parameters and return values, variables, callbacks, closures, goroutines, and common mistakes like loop capture.

Deepak Prasad7 min read
programming

Golang os exit, defer, and why deferred functions are not run

Golang os exit defer: os.Exit golang behavior matches pkg.go.dev os Exit — program terminates immediately and deferred functions are not run; patterns to run cleanup before exit, go os.exit deferred functions official …

Tuan Nguyen4 min read
programming

Golang os.Stat: file metadata, FileInfo, and os.ErrNotExist

Golang os.stat and golang os stat: os.Stat returns fs.FileInfo (name, size, mode, mod time, IsDir); *File.Stat; errors.Is(err, os.ErrNotExist); os.Lstat vs Stat; PathError. Related os package file I/O.

Tuan Nguyen3 min read
programming

Golang json omitempty: meaning, zero values, and nested structs

Golang json omitempty and omitempty meaning in encoding/json; golang omitempty with strings, numbers, pointers; why omitempty has no effect omitting nested struct value fields; use pointers for optional objects; go json …

Tuan Nguyen4 min read
programming

Golang reverse range and iterate a slice backwards

Golang reverse range and golang range reverse with a backward index loop; golang range backwards using forward range and remapped index; golang iterate over slice and golang iterate slice backwards; golang reverse slice …

Tuan Nguyen3 min read
programming

Golang split string and assign to variables: strings.Split, Fields, and Cut

Golang split string and golang string split with strings.Split and strings.Fields; strings split golang and go split string; golang split string into two variables with strings.Cut or slice indexing; net.SplitHostPort …

Tuan Nguyen3 min read
programming

Golang set cookie and golang http cookie with net/http

Golang set cookie with http.SetCookie and http.Cookie, golang http cookie headers, golang cookies and cookie golang reads via Request.Cookie, Path Domain MaxAge Expires SameSite Secure HttpOnly, order before Write, curl …

Tuan Nguyen4 min read
programming

Golang os package: Open, Create, WriteFile, and *os.File

Golang os package for files: golang os open and OpenFile, os create golang with os.Create, os writefile golang with os.WriteFile, *os.File reads and append, Stat and errors.Is(os.ErrNotExist), Remove.

Tuan Nguyen4 min read
programming

Golang iterate over array: range and for loops with len

Golang iterate over array and golang array loop with for range; golang for loop array and golang loop through array using len; go iterate over array and iterate over array golang with index or values only.

Tuan Nguyen3 min read
programming

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 …

Antony Shikubu4 min read
programming

Convert Go []byte to string (Casting, Builder, Buffer, strconv)

Convert go bytes to string with string(b), fmt.Sprintf, strings.Builder or bytes.Buffer, strconv for numbers, and know when copying happens for UTF-8 text and binary data.

Deepak Prasad2 min read
programming

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.

Antony Shikubu2 min read
programming

Get Current Time in Milliseconds in Go (UnixMilli and Alternatives)

Convert time.Time to Unix milliseconds with UnixMilli, derive ms from UnixNano, or use Duration.Milliseconds after Sub; know int64 range limits from the time package docs.

Tuan Nguyen2 min read
programming

Golang io.ReadCloser: Reader+Closer, NopCloser, and read to string

io.ReadCloser golang and golang readcloser: embed io.Reader and io.Closer, io.NopCloser / nopcloser for Readers without real Close, golang io reader examples, and io.readcloser to string with io.ReadAll plus defer Close.

Tuan Nguyen3 min read
programming

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 …

Antony Shikubu4 min read
programming

Golang integer types: int, int32, int64, uint, and sizes

Golang int and go int types, golang int types and sizes, golang int vs int32, uint and sized integers, byte and rune aliases, and how golang data types size depends on int versus int8–int64.

Deepak Prasad4 min read
programming

Golang int to int64 and int64 to int conversion

Golang int to int64 and golang convert int to int64 with T conversions; golang int64 to int and int64 to int golang narrowing; go int to int64; golang cast int to int64; strconv round trip; portability when int is 32 …

Tuan Nguyen3 min read
programming

Convert float64 to int or int64 in Go (cast, round, strconv)

Golang float64 to int and golang float64 to int64: convert with int()/int64() truncation, math.Round for nearest integer, golang convert float to int and golang convert float64 to int safely, plus float64 to int golang …

Tuan Nguyen3 min read
programming

Golang CPU affinity on Linux: sched_setaffinity, taskset, GOMAXPROCS

Golang CPU affinity on Linux: cpu masking with golang.org/x/sys/unix SchedSetaffinity, taskset from Go, runtime.LockOSThread for set thread affinity, and why gomaxprocs golang is not affinity.

Deepak Prasad4 min read
programming

FlashDB in Go: in-memory key-value store with optional persistence

FlashDB golang tutorial: an in memory database golang option and golang key value store with Redis-style types. Covers go in memory database setup, transactions, string SET/GET/DELETE, disk vs pure memory, and links for …

Tuan Nguyen4 min read
programming

Golang nil checks: pointers, interfaces, slices, and empty structs

Golang check if nil for pointers and maps; golang null pointer with == nil; check if slice is empty golang (len vs nil); golang check if struct is empty (not nil—reflect.IsZero); golang check if interface is nil …

Tuan Nguyen5 min read
programming

Go HTTPS Client: Skip TLS Verify (InsecureSkipVerify) and Safer Options

Use tls.Config InsecureSkipVerify on a dedicated net/http Transport for golang http client skip tls verify only in dev; prefer fixing golang ssl certificate trust with RootCAs instead of golang disable ssl verification …

Tuan Nguyen4 min read
programming

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, …

Antony Shikubu5 min read
programming

Golang seek on files: os.File.Seek and whence constants

Golang file seek and go file seek with (*os.File).Seek: io.SeekStart, io.SeekCurrent, io.SeekEnd, temp-file examples, and bytes.Reader for in-memory golang seek.

Tuan Nguyen4 min read
programming

GraphQL in Go: golang graphql tutorial, examples, and HTTP server

Graphql golang tutorial and golang graphql example with github.com/graphql-go/graphql: schema, resolvers, graphql.Do, context, HTTP handler and Playground, go graphql patterns, graphql golang vs REST, and graphql mongodb …

Tuan Nguyen5 min read
programming

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 …

Antony Shikubu3 min read