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 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 Time Package: time.Now, Duration, Format, and Parse Examples

Use Go time package for time.Now, time.Duration, formatting and parsing, Add and Sub, Since and Until, comparing times, Sleep, Timer, and Ticker basics, plus common mistakes.

Deepak Prasad8 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 Nguyen7 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 Prasad4 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 Nguyen5 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 Iftikhar5 min read
programming

Golang Subtract Time: time.Now Minus Duration Examples

Subtract time in Go with time.Add and negative durations, time.Now minus 1 hour, time.Sub for differences between two time.Time values, AddDate for calendar days and months, and common mistakes.

Tuan Nguyen8 min read
programming

Golang Switch Case Statement: Examples, Multiple Cases, and Type Switch

Use the switch statement in Go for switch case and default, comma-separated cases, expressionless switch, initial statements, type switch on any, fallthrough, and patterns that replace long if-else chains.

Deepak Prasad9 min read
programming

Find GCD in JavaScript (Euclidean algorithm, BigInt, mathjs)

GCD in JavaScript (greatest common divisor, not denominator): Euclidean gcd recursive and iterative with Math.abs for negatives, reduce fold for many numbers, BigInt gcd without mixing Number, optional mathjs variadic …

Olorunfemi Akinlua4 min read
programming

Golang Function as Parameter Explained with Examples

Pass functions as parameters in Go: func types, named and anonymous arguments, callbacks, defined function types, method values and expressions, errors, and when to prefer an interface or generics.

Tuan Nguyen8 min read
programming

Install Go on Ubuntu: apt, snap, or official tarball (with checksum)

Installing golang on Ubuntu: apt golang-go, snap install go --classic, official go.dev/dl tarball with sha256 verify, optional build-from-source with bootstrap Go, amd64 and arm64, PATH and GOBIN, go version, go mod init …

Deepak Prasad7 min read
programming

Go get private repository: GOPRIVATE, SSH, HTTPS, and go mod private repo

Go get private repository and golang private repo with modules: GOPRIVATE, GONOPROXY, GONOSUMDB, SSH insteadOf HTTPS, PAT and .netrc, go no secure protocol found for repository, terminal prompts disabled, GitHub GitLab …

Tuan Nguyen4 min read
programming

Golang MongoDB tutorial: driver v2, BSON, ObjectId, and CRUD

Step-by-step golang and mongodb with go.mongodb.org/mongo-driver/v2: URI connect Ping, implicit create database, BSON golang bson ObjectId, CRUD, bson regex golang, dates; legacy mgo note.

Tuan Nguyen6 min read
programming

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.

Antony Shikubu4 min read
programming

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.

Antony Shikubu2 min read
programming

Encrypt and decrypt strings in Go with AES-GCM

Encrypt and decrypt byte slices or strings in Go using AES-256 with GCM for confidentiality and integrity, a random nonce per message, and base64 for storage; extend the same pattern to files by reading and writing raw …

Tuan Nguyen2 min read
programming

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.

Antony Shikubu2 min read
programming

Golang lint and go vet: golangci-lint, formatting, and nolint:gosec

Golang linting with go vet and golangci-lint; go lint command meaning versus go vet; golang linter setup; nolint:gosec and targeted nolint directives; gofmt goimports; golint deprecated.

Tuan Nguyen3 min read
programming

Golang get IP address: local IPv4/IPv6, hostname, and Linux interfaces

Golang get ip address and golang get local ip: net.InterfaceAddrs and Interfaces for linux get local ip, golang get hostname with LookupHost, go get ip address heuristics, golang get local ip address without loopback, …

Deepak Prasad3 min read
programming

Golang URL query parameters: url.Values, encoding, and reading requests

Golang url values and url.Values.Encode to add query parameters; golang http request parameters from r.URL.Query; golang url parameters with Set and Add; avoid raw fmt.Sprintf for untrusted strings. Related HTTP overview …

Tuan Nguyen2 min read
programming

Golang HTTP POST JSON: send a post request with a JSON body in Go

Golang http post json and golang post request with json body using net/http: http.NewRequest with bytes.Reader, Content-Type application/json, json.Marshal, and a minimal server decode with json.Decoder; httptest example …

Tuan Nguyen3 min read
programming

Golang performance and speed: how Go compares and why it is fast

Golang performance versus Java, Python, Node.js, and C; why the Go language feels fast for servers; golang performance benchmark with go test; golang closure performance basics; links to official docs and community …

Tuan Nguyen5 min read
programming

Go pass by value or reference: pointers, slices, and maps in Go

Is go pass by value or reference: Go passes arguments by value; golang pass by reference means passing pointers. go pass by value for structs; slices and maps alias shared data. golang pass by reference or value, golang …

Tuan Nguyen3 min read
programming

Golang print struct: fmt verbs, pretty JSON, and type names

Print struct golang and go print struct with fmt.Printf verbs (%v %+v %#v), golang pretty print struct via encoding/json, golang print type of variable with %T and reflect.TypeOf, fmt.Stringer, and optional go-spew.

Tuan Nguyen3 min read
programming

Golang queue: FIFO slice, container/list, and channels

Golang queue implementation for FIFO: slice append and reslice, golang fifo queue memory notes, container/list, buffered channel go queue, generics helpers, peek and empty checks, concurrency hints, and links to channels …

Tuan Nguyen4 min read
programming

Golang read password from stdin: x/term ReadPassword and TTY checks

Golang read password from stdin with golang.org/x/term ReadPassword: pkg.go.dev ReadPassword IsTerminal, example os.Stdin.Fd and syscall.Stdin on Linux, ReadPassword Windows and platforms, no echo vs golang asterisk …

Deepak Prasad3 min read
programming

Golang prompt and interactive CLI: stdin, passwords, promptui, survey

Golang interactive CLI and golang prompt for input with bufio; golang.org/x/term ReadPassword with os.Stdin.Fd; promptui golang and survey; go-prompt (c-bata); notes on TTYs and cross-platform terminals.

Tuan Nguyen4 min read
programming

Golang read file, update in place, and overwrite safely

Golang read file and golang read entire file with os.ReadFile; golang open file and os.OpenFile flags; golang overwrite file and append; update one field of big file golang via temp file rename or streaming; WriteAt …

Tuan Nguyen5 min read
programming

Golang multiline string and reading multiple lines from stdin

Golang multiline string with raw backticks and escapes; golang read stdin and golang read line from stdin using fmt.Scan tokens, bufio.Reader ReadString, and bufio.Scanner; EOF and token size notes; not golang multiline …

Tuan Nguyen4 min read