Articles by Deepak Prasad
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 …
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 …
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 …
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 …
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.
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.
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.
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.
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.
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 …
JavaScript setTimeout(): Delay Code Execution
Learn JavaScript setTimeout() with delay examples, clearTimeout(), callback arguments, async behavior, and common mistakes in browsers and Node.js.
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.
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.
Understanding Docker Vs Containerd
Container execution is handled by containerd. You can think of it as a container supervisor that handles container lifecycle operations.
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
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
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 …
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 …
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.
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 …
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.
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, …
Unit Testing Operator Reconcile Logic with Ginkgo and Gomega
Structure reconciler unit tests with Ginkgo and Gomega: table-driven vs Describe/Context/It, testing pure desired-state builders vs full Reconcile with the fake client, asserting ctrl.Result and errors, when to stop and …
CI/CD for Kubernetes Operator Projects with GitHub Actions
Create a production-ready GitHub Actions CI/CD workflow for Go Kubernetes Operators: gofmt, go vet, unit tests, envtest, Makefile targets, image builds, GHCR publishing, OLM bundle validation, kind jobs, caching, …
OLM Bundles Explained: Package, Ship, and List on OperatorHub
Learn OLM bundles for Kubernetes Operators: bundle layout, CSV fields, replaces and skips, operator-sdk bundle generate validate scorecard, catalog images with opm, testing on kind with OLM, and how CSV claims map to …
OpenTelemetry Tracing for controller-runtime Operators
Add OpenTelemetry tracing to Go operators on controller-runtime: why trace reconcile, wiring TracerProvider and OTLP, propagating context into client-go and outbound HTTP, span naming and log correlation via trace id, …
Kubernetes Operator Metrics with Prometheus and controller-runtime
Expose Kubernetes Operator metrics from controller-runtime, scrape them with prometheus-operator ServiceMonitor, secure the endpoint, add custom Prometheus metrics, build useful Grafana panels, alert on reconcile errors, …
Pause and Resume Patterns for Kubernetes Operators
Design pause and resume for Kubernetes Operators: spec.paused vs annotations, what still runs when paused, skipping child updates vs deletes, finalizers and upgrades, Helm operator limits, user-facing docs, and GitOps …
From Commit to Cluster: End-to-End Operator Release Pipeline
Release a Kubernetes Operator from Git tag to cluster: build the manager image, pin digests, render Helm or Kustomize manifests, validate CRDs and OLM bundles, smoke-test with a sample CustomResource, promote through …
Configuration for Operators: Flags, Environment Variables, and Live Reload
Configure Kubernetes Operators for real clusters: cmd flags vs env vars, WATCH_NAMESPACE and common conventions, ConfigMap and Secret mounts, live reload with watches, Downward API, secret rotation, and 12-factor style …

