Blog

Latest Articles - Page 57

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

3098 articles

Blog illustration with latest articles, tutorials, guides, and how-to content across Linux and DevOps topics
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 Nguyen7 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 Nguyen5 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 Prasad8 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 Nguyen9 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 Prasad14 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 Prasad7 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 Shikubu8 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 Prasad6 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 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 Shikubu9 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 Nguyen16 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 Prasad10 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 Nguyen8 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 Nguyen4 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 Shikubu12 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 Shikubu12 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 Nguyen9 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 Nguyen5 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 Prasad9 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 Shikubu7 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 Prasad3 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 Nguyen8 min read
programming

Golang multiply duration by integer: int to time.Duration

Golang multiply time duration and fix mismatched types int and time.Duration; golang int to time.Duration with time.Duration(n)*time.Second; constants; golang time duration example; max int64 nanoseconds overflow.

Tuan Nguyen3 min read
programming

Golang multiline string: raw literals, concatenation, and variables

Golang multiline string and go multiline string: raw string literals in backticks, golang multiline string literal rules, concatenation with \\n, golang multiline string with variables via fmt and strings.Builder.

Tuan Nguyen3 min read
programming

Golang Ticker Example: Run Code Repeatedly with time.NewTicker

Use time.NewTicker in Go for repeated work at a fixed interval: ticker.C, Stop, Reset, select with done or context, goroutine patterns, timer vs ticker, time.Tick pitfalls, and common mistakes.

Tuan Nguyen8 min read
programming

Golang background process: start, monitor, and wait with os/exec

Golang start process and spawn with os/exec Start Wait and Run; CommandContext timeouts; goroutines channels WaitGroup for golang background jobs; go run in background vs shell; wait golang patterns.

Deepak Prasad5 min read
programming

Golang HTTP client timeout and server timeouts with a test server

Golang http client timeout and go http client timeout: http.Client zero means no timeout per pkg.go.dev, Transport dial TLS ResponseHeaderTimeout, context request deadline, golang http timeout vs golang http request …

Tuan Nguyen6 min read
programming

Golang Check If String Is Empty: Empty vs Blank String

Check if a string is empty in Go with s == "" or len(s) == 0, tell empty from whitespace-only strings, use strings.TrimSpace for blank input, and remember string is never nil.

Azka Iftikhar6 min read