Category

Programming Tutorials and Coding Guides

Explore programming tutorials with practical examples across multiple languages, scripting, and development concepts for beginners and advanced users.

Welcome to the Programming tutorials section, where you will learn coding concepts with real-world examples across multiple languages and platforms.

This category includes beginner to advanced guides covering scripting, automation, and application development in Java, JavaScript, Python, Go, TypeScript, and related stacks.

Whether you are learning programming for system administration or building applications, browse the articles below for practical examples and language-specific references.

Programming plays a crucial role in modern infrastructure and DevOps workflows. You can also explore DevOps and Linux to see how code integrates with system-level operations.

956 articles

Programming category illustration with code editor, automation, and debugging graphics
programming

Golang flag package examples: CLI flags, multiple values, subcommands

Golang flag and golang flags examples using the standard library flag package: go flag and go CLI flags, golang flag example for string, int, and bool, golang flag multiple values with flag.Value, required flags, …

Antony Shikubu5 min read
programming

Golang seek on files: os.File.Seek and whence constants

Golang file seek and go file seek with (*os.File).Seek: io.SeekStart, io.SeekCurrent, io.SeekEnd, temp-file examples, and bytes.Reader for in-memory golang seek.

Tuan Nguyen4 min read
programming

GraphQL in Go: golang graphql tutorial, examples, and HTTP server

Graphql golang tutorial and golang graphql example with github.com/graphql-go/graphql: schema, resolvers, graphql.Do, context, HTTP handler and Playground, go graphql patterns, graphql golang vs REST, and graphql mongodb …

Tuan Nguyen5 min read
programming

Golang break and continue: inner loop, outer loop, and select

Golang break and golang continue for go break loop and golang break for loop; golang break outer loop and golang continue outer loop with labels; golang select break exits the select—use a label to leave the surrounding …

Antony Shikubu3 min read
programming

Golang Fiber CRUD API tutorial: routes, JSON, and Postman

Go fiber tutorial and golang fiber CRUD REST demo: fiber golang routing, fiber routes API with grouped paths, JSON handlers with Fiber, in-memory articles, Postman screenshots—practical codebase for fiber go and fiber …

Antony Shikubu11 min read
programming

Golang FIFO and named pipes: mkfifo, syscall.Mkfifo, EOF, open modes

Golang fifo and golang mkfifo: create fifo files with syscall.Mkfifo or mkfifo command in linux, golang named pipe reader and writer, O_RDONLY vs O_RDWR and EOF handling—linux fifo example and go fifo inter-process …

Antony Shikubu3 min read
programming

Golang bool to string: FormatBool, Sprintf, and string to bool

Golang bool to string and bool to string golang: strconv.FormatBool for golang convert bool to string, golang sprintf bool with fmt.Sprintf %t or %v, golang string to bool with strconv.ParseBool, go bool to string …

Tuan Nguyen2 min read
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 sort slice and array: Ints, Slice, SliceStable, descending

Golang sort slice and go sort slice: sort.Ints, sort.Strings, golang sort array with a slice view, sort.Slice and sort.SliceStable, golang sort descending and reverse slice golang, sort.Sort with IntSlice and …

Tuan Nguyen4 min read
programming

Golang Run Function at Intervals: Ticker, Sleep, and Cron Examples

Run repeated tasks in Go with time.NewTicker and time.Sleep, stop loops with context, avoid overlapping runs, and use robfig/cron/v3 for wall-clock schedules.

Tuan Nguyen6 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

Go environment variables: getenv, setenv, lookup, go env, and .env files

Go environment variables and golang environment variables: golang get environment variable with LookupEnv, golang set environment variable with Setenv, go env vs process env (golang env, go env variables), env golang and …

Antony Shikubu5 min read
programming

Golang const array: why Go has no constant slices, and what to do instead

Golang const array and golang constant array: Go constants are only numbers, strings, booleans, and complex values built from those—no golang constant slice or const array type; patterns for golang const string array, go …

Tuan Nguyen4 min read
programming

GOPATH vs GOROOT: what is GOROOT, go root, and how they differ

Gopath vs goroot and goroot vs gopath: what is goroot (go root / golang goroot), GOPATH for your workspace, why GOPATH and GOROOT must not be the same directory, go env GOROOT and go env GOPATH, modules and GOMODCACHE, …

Tuan Nguyen4 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

Golang new error: errors.New, fmt.Errorf, and custom errors

Golang new error and golang create error with errors.New and fmt.Errorf; errors new golang patterns, sentinels, errors.Is, %w wrapping, and custom types implementing error.

Tuan Nguyen4 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 append to slice: elements, another slice, and []byte rules

Golang append and append golang: golang add to slice, golang append to slice and golang slice append with variadic ..., golang append slice to slice, go append to array semantics, []byte plus string append, and always …

Tuan Nguyen3 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

Golang init function: syntax, rules, and order of execution

Golang init and go init: func init() rules, init order across imports and files, multiple init functions, blank imports, when to use or avoid init(), with spec-aligned examples.

Tuan Nguyen5 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

Golang prompt for input: interactive CLI with bufio and fmt

Golang prompt for input and go interactive cli: read lines from stdin with bufio for a go prompt, yes/no prompts, Scanln loops, and validation with strconv; note c-bata go-prompt library vs stdlib for golang prompt and …

Tuan Nguyen4 min read
programming

Go get specific version and go get version with Go modules

Go get specific version and go get version with modules: go get with version and go get package version using @v1.2.3, go list for go get version of package, go update package to specific version with @latest and …

Tuan Nguyen4 min read
programming

Golang Time Format: Date, Time, RFC3339, Parse, and Layout Examples

Format and parse time in Go using the reference layout 2006-01-02 15:04:05, time.Now().Format, RFC3339, Z07:00 for UTC as Z, Parse and ParseInLocation, common mistakes with YYYY-MM-DD, and copy-paste layout tables.

Tuan Nguyen7 min read
programming

go.mod file not found in current directory or any parent directory — fix

Fix go.mod file not found in current directory or any parent directory and go: go.mod file not found errors: how Go walks up for go.mod, cd to module root, go mod init, nested modules, and go get no longer supported …

Tuan Nguyen4 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