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

Check if a string contains a substring in Go (strings.Contains)

strings.Contains for literal UTF-8 substrings, case sensitivity and ToLower, match any or all needles, ContainsAny and ContainsRune, Index and HasPrefix or HasSuffix, empty substring behavior, and regexp only when you …

Deepak Prasad6 min read
programming

Golang SHA-512: Sum512, hex, files, streams, salt verify, and SHA-256 comparison

Golang SHA-512 with crypto/sha512: Sum512 and hex, sha512.New streaming io.Copy, file checksum verify, streams vs one-shot, salt-and-hash demo with verification caveats, SHA-512 vs SHA-256, HMAC, use cases, passwords …

Tuan Nguyen9 min read
programming

Golang Compare Strings: Equality, Ordering, and Case-Insensitive Match

Compare strings in Go with == and !=, lexicographic order with < and >, strings.EqualFold for case-insensitive match, strings.Compare for three-way results, and trimming input before comparing.

Tuan Nguyen5 min read
programming

Golang Command Line Arguments: os.Args, Flags, and Examples

Read command-line arguments in Go with os.Args, use the flag package for named options, validate positional args, parse numbers safely, and understand go run vs a compiled binary.

Tuan Nguyen6 min read
programming

What Is Ampersand in Golang? & and * Pointer Operators Explained

Learn what ampersand means in Go, how & gets a variable address, how * works with pointers, and how & and * are used together in simple examples.

Tuan Nguyen4 min read
programming

Golang Variable Scope: Local, Package-Level, Global, and Block Scope

Learn variable scope in Go, including local variables, package-level variables, global-style variables, block scope, short declarations, shadowing, and best practices.

Deepak Prasad7 min read
programming

Go Import Underscore Explained: Blank Imports and Side Effects

Learn why Go uses underscore before an import path, how blank imports work, when packages are imported for side effects, and how this relates to unused import errors.

Tuan Nguyen8 min read
programming

Golang Web Server Tutorial: Build and Configure an HTTP Server in Go

Learn how to build a Go web server using net/http, configure routes, handlers, ports, timeouts, static files, JSON responses, and graceful shutdown.

Deepak Prasad13 min read
programming

Golang Closure Function: Closures, Captured Variables, and Performance

Learn closures in Go: function values that capture outer variables, how they differ from anonymous functions, returned functions and state, goroutine loop pitfalls, and golang closure performance and escape analysis.

Deepak Prasad6 min read
programming

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.

Antony Shikubu7 min read
programming

Golang Buffered Channel: Capacity, Blocking, and Buffered vs Unbuffered

Learn buffered channels in Go: make(chan T,n) capacity, len and cap, when send and receive block, buffered vs unbuffered channels, backpressure, deadlocks, choosing buffer size, and practical patterns.

Deepak Prasad5 min read
programming

Import Local Package in Go Without GOPATH: Step-by-Step Go Modules Example

Learn how to import a local Go package without GOPATH using go.mod, module paths, subfolders, exported names, replace directives, and go.work.

Tuan Nguyen8 min read
programming

Golang SHA-256: Sum256, hex, files, streams, verification, and security notes

Golang SHA-256 with crypto/sha256: Sum256 and hex, sha256.New streaming io.Copy, file checksums and verification, compare files, subtle comparison, HMAC sign/verify, MD5 vs SHA-1 vs SHA-256, passwords use bcrypt; quick …

Tuan Nguyen10 min read
programming

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.

Antony Shikubu8 min read
programming

Golang Regexp Tutorial: Match, Find, Replace, and Extract Regex Groups

Learn how to use regex in Go with the regexp package, including MatchString, Compile, MustCompile, FindString, submatches, ReplaceAllString, Split, and common mistakes.

Deepak Prasad9 min read
programming

Golang Slice Contains and Find Index: Contains, Index, and IndexFunc

Learn how to check if a Go slice contains a value, find the index of an element, search by condition with IndexFunc, and choose between slices, loops, and maps.

Tuan Nguyen15 min read
programming

Goroutine vs Thread in Go: Are Goroutines the Same as Threads?

Understand the difference between goroutines and OS threads in Go, how the Go runtime scheduler maps goroutines onto threads, and why goroutines are lightweight.

Deepak Prasad9 min read
programming

Golang Anonymous Struct: Inline Structs, JSON, Methods, and Return Values

Learn anonymous structs in Go: inline struct syntax, JSON tags, slices and maps, returning unnamed struct types, why methods attach to named types, embedding vs anonymous fields, and when to use a named struct.

Tuan Nguyen7 min read
programming

Golang import local package: modules, paths, and another directory

Golang import local package and go import local package with Go modules: golang import package from another directory under the module root, golang use local package and golang local package import paths, golang import …

Tuan Nguyen3 min read
programming

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

Antony Shikubu10 min read
programming

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.

Antony Shikubu11 min read
programming

Best Go Web Frameworks: Gin, Echo, Fiber, Chi, and net/http Compared

Compare popular Go web frameworks including Gin, Echo, Fiber, Chi, Beego, and net/http. Learn which framework fits REST APIs, microservices, web apps, and high-performance services.

Tuan Nguyen8 min read
programming

Golang byte to int and []byte to int: strconv, binary, big.Int

Golang byte to int: uint8 widening, []byte ASCII to int with strconv.Atoi and validated ParseInt, math/big SetBytes for long unsigned magnitudes, encoding/binary Uint32 Uint64 and Read for int32, reverse int64 to []byte …

Tuan Nguyen5 min read
programming

Golang HTTP and HTTPS servers with net/http and ListenAndServeTLS

Golang http and go http with net/http: golang http server example using ListenAndServe and ServeMux, golang https server and https golang with http.ListenAndServeTLS, golang http module meaning the standard library …

Tuan Nguyen4 min read
programming

Golang portping: TCP checks with Ping and PingN (sequential, parallel, ranges)

Golang portping with janosgyerik/portping: set up module, Ping and PingN API, sequential and parallel TCP checks, port ranges, PingN result handling, retries, per-dial timing, CLI install, common dial errors; links to …

Deepak Prasad8 min read
programming

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.

Antony Shikubu6 min read
programming

Go ternary operator: idiomatic alternatives to `?:` (if, switch, min, cmp.Or)

Go has no ?: ternary; idiomatic equivalent is if/else or switch. Covers lazy branches, min/max builtins, cmp.Or defaults, generic pick helpers, pitfalls of eager helpers, optional julien040/go-ternary, links to if/else, …

Deepak Prasad6 min read
programming

Golang store values in a struct using a for loop

Store slice values into structs with for range, golang iterate over struct fields with reflect, and a short golang forloop refresher—correct Go, no broken examples.

Deepak Prasad2 min read
programming

Golang Handle Ctrl+C: Catch SIGINT and Run Cleanup Before Exit

Learn how to catch Ctrl+C in Go with os/signal, handle SIGINT and SIGTERM, run cleanup before exit, choose between signal.Notify and signal.NotifyContext, and how Docker and PID 1 differ from a normal terminal.

Tuan Nguyen7 min read
programming

Golang Read YAML File: Parse YAML into Struct, Map, or Decoder

Learn how to read and parse YAML files in Go using gopkg.in/yaml.v3: YAML to struct, YAML to map, nested YAML, lists, os.ReadFile, yaml.NewDecoder, multi-document YAML, KnownFields for strict keys, scalar pitfalls, and …

Tuan Nguyen12 min read