Author

Deepak Prasad

Deepak Prasad

R&D Engineer

at · 1116 articles published

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, networking, and security, delivering robust and efficient solutions for diverse projects.

Areas of expertise

Certifications & credentials

  • Red Hat Certified System Administrator in Red Hat OpenStackID: 180-246-001
  • Certified Kubernetes Application Developer (CKAD)
  • Red Hat Certified Specialist in Ansible Automation
  • Go: Data Structures, Algorithms and Design Patterns With Go
Author profile illustration for Deepak Prasad — technical writer at GoLinuxCloud

Articles by Deepak Prasad

programming

Golang base64 encode and decode with encoding/base64 and JSON

Golang base64 and base64 golang: StdEncoding EncodeToString DecodeString, URLEncoding, padding; golang base64 decode and base64 decode golang; golang json prevent encoding byte to base64 when json.Marshal treats []byte …

Deepak Prasad4 min read
programming

Golang escape backslash and escape string: raw literals vs "quoted"

Golang escape string and go escape string: golang escape backslash with doubled backslash in double-quoted strings, golang escape characters in interpreted literals, raw string literals for paths, and golang escape …

Deepak Prasad3 min read
programming

Golang array of structs and slice of structs: declare, init, iterate

Golang array of structs and golang struct array: [n]T fixed array vs []T slice, golang initialize array of structs with literals or loops, golang make array of structs with make, golang list of structs and go array of …

Deepak Prasad3 min read
programming

Golang sed and awk examples from Go with os/exec

Golang sed and go sed: call sed and awk from Go with os/exec, stdin pipes, temp files, and notes on in-place edits and golang execute shell command patterns.

Deepak Prasad4 min read
programming

Remove or Delete Elements from a Slice in Go (First, Last, by Index)

Remove the first or last element from a slice in Go, delete by index while keeping order or in O(1) with swap-and-truncate, drop a run of elements, and use slices.Delete on Go 1.21+.

Deepak Prasad4 min read
programming

Golang cast to string: int, any, and bool with strconv and fmt

Golang cast to string and go cast to string: golang int to string and convert int to string golang with strconv and fmt; golang convert any to string and golang cast any to string with type switches and fmt.Sprint; bool …

Deepak Prasad3 min read
programming

Access a Go variable from another package: exports, imports, and globals

Golang global variables across packages: package-level vars with an exported name (capital letter), import path module/subpkg, golang declare global variable in util and read from main; why main cannot be imported and …

Deepak Prasad3 min read
programming

Golang fsnotify: Watch File and Directory Changes in Go

Use fsnotify in Go to watch files and directories, handle create/write/remove/rename events, watch parent directories for single files, handle symlinks, debounce noisy saves, and avoid common watcher mistakes.

Deepak Prasad16 min read
programming

Golang read file into string or variable: os.ReadFile, embed, Open

Golang read file into string and read file golang: os.ReadFile for golang read file to string, go read file to string and []byte, //go:embed for build-time content, os.Open with io.ReadAll; notes for golang read from …

Deepak Prasad3 min read
programming

Go map to struct: convert map[string]any and round-trip with structs

Golang map to struct and golang convert map to struct: map[string]any (map string interface) to struct via json.Marshal or mapstructure, manual loops, reflect; plus convert struct to map golang with JSON for map to …

Deepak Prasad5 min read
programming

Go const map and constant map: Why They Are Not Allowed and What to Use Instead

Go does not allow golang const map or golang map const literals: constants must be compile-time values of allowed types. Use a golang global map with var and init, getters over unexported maps, or functions that return …

Deepak Prasad4 min read
programming

Go map to JSON: convert, print, and parse back with encoding/json

Golang map to JSON and JSON string: json.Marshal and string(bytes) to convert map to json golang, MarshalIndent and Encoder to print map as JSON, then json.Unmarshal for json to map golang (map[string]any) with …

Deepak Prasad3 min read
programming

Create a Go Module: go mod init, go.mod, and a Small Example

Learn golang create module workflow with go mod init to generate go.mod, pick a golang module name, enable modules by default, and add a nested package plus tests—without relying on GOPATH src layout.

Deepak Prasad5 min read
programming

Golang return multiple values from a function

Golang return multiple values and go function return multiple values: syntax, two-value returns, mixed types, blank identifiers, (T, error), and named results.

Deepak Prasad4 min read
programming

Golang return error: create, wrap, and check errors in Go

Golang return error and go return error: the error interface, errors.New and fmt.Errorf, if err checks, wrapping with %w, errors.Is and errors.As, and turning an error into a string.

Deepak Prasad4 min read
programming

Go Type Casting: Conversions, Assertions, and Interface to Struct

Golang cast and go cast usually mean explicit type conversion (numeric) or type assertion from any: golang type casting vs strconv for strings, safe v.(T) and golang cast interface to struct with value or pointer types.

Deepak Prasad4 min read
programming

Golang remove duplicates from slice: dedupe and unique values

Golang remove duplicates from slice: preserve order with a map, sort then Compact for sorted unique, counts with map, and the XOR trick for one odd-count value.

Deepak Prasad3 min read
programming

Golang Variadic Function: ... Syntax, Varargs, and Slice Examples

Variadic functions in Go use ...T for the last parameter (varargs), behave like []T inside the body, and accept slice arguments with slice.... Compare ... at define vs call, mix fixed parameters, ...any, and common …

Deepak Prasad7 min read
programming

JavaScript setTimeout(): Delay Code Execution

Learn JavaScript setTimeout() with delay examples, clearTimeout(), callback arguments, async behavior, and common mistakes in browsers and Node.js.

Deepak Prasad4 min read
programming

Check if a Go Channel Buffer Is Full or Empty (len, cap, select)

Use len and cap on buffered Go channels to detect full or empty buffers, try a send with select and default, and know why unbuffered channels and “is it closed?” need different patterns.

Deepak Prasad4 min read
programming

Cannot use import statement outside a module

Fix SyntaxError cannot use import statement outside a module in Node.js, browsers, and AWS Lambda. Use type module, .mjs, script type=module, and avoid ERR_MODULE_NOT_FOUND confusion—with Node-tested output.

Deepak Prasad6 min read
devops

Understanding Docker Vs Containerd

Container execution is handled by containerd. You can think of it as a container supervisor that handles container lifecycle operations.

Deepak Prasad6 min read
linux

Top 5 Best Practices for Containerized Deployments

Even though containers are valuable in the current software development trends, realizing containerized deployments in organizations is not easy. This article

Deepak Prasad5 min read
linux

7 tools to detect Memory Leaks with Examples

How to detect, capture and monitor memory leak in various applications such as C, C++ or in Linux process. use valgrind, core dump to capture leak information

Deepak Prasad17 min read
cheatsheet

How to limit CPU using cgroups (v2 and v1) on Linux

How to cap CPU with Linux cgroups: cgroup v2 cpu.max and cpu.stat, cgroup v1 cfs quota files, systemd CPUQuota and CPUWeight, shared limits with systemd slices, optional CPUQuotaPeriodSec, plus how this differs from …

Deepak Prasad14 min read
linux

How to Check Memory Usage per Process in Linux

Learn how to check memory usage by process in Linux with tested ps, top, pmap, /proc, smaps_rollup, statm, free, and pidstat examples. Understand RSS, VSZ, PSS, USS, shared memory, and how to find the top …

Deepak Prasad10 min read
linux

Linux memory limits in containers (cgroups, Docker, Kubernetes)

Learn how Linux enforces memory limits inside containers using cgroups, how cgroup v1 and v2 differ, why tools disagree, and how Docker and Kubernetes map limits to the kernel.

Deepak Prasad23 min read
devops

Debugging Kubernetes Operators: kubectl, Logs, and Webhook Failures

Learn how to debug Kubernetes Operators from the outside in: manager logs and flags, kubectl describe and events, stuck Terminating resources, validating and mutating webhooks (TLS, caBundle, cert-manager), conversion …

Deepak Prasad14 min read
programming

Check if a key exists in a JavaScript object: 7 reliable patterns

Check if key exists in object JavaScript: Object.hasOwn, in, hasOwnProperty, Object.keys, getOwnPropertyNames, symbols, Reflect.ownKeys—with example console output and own vs inherited rules.

Deepak Prasad7 min read
devops

Kubernetes Operator Tutorial - Build Production-Ready Operators

Free Kubernetes Operator course with hands-on lessons from core concepts through production Go, Helm, and hybrid operators—plus observability, security, CI/CD, and OLM packaging. Built on controller-runtime, Kubebuilder, …

Deepak Prasad1 min read