1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-09-02 22:02:39 +02:00

Add go roadmap content

This commit is contained in:
Kamran Ahmed
2025-07-15 20:17:16 +01:00
parent 0bcda11f85
commit bfb348141c
182 changed files with 540 additions and 170 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 545 KiB

View File

@@ -0,0 +1,3 @@
# Advanced Topics
Advanced Go topics include memory management, escape analysis, reflection, unsafe operations, CGO, and performance optimization. These sophisticated features enable building high-performance systems and solving specialized problems requiring deep language knowledge. While not needed for typical development, mastering these topics helps leverage Go's full capabilities.

View File

@@ -1 +1,3 @@
# Anonymous Functions
# Anonymous Functions
Anonymous functions in Go are functions declared without a name, also known as function literals or lambda functions. They can be assigned to variables, passed as arguments to other functions, or executed immediately. Anonymous functions are useful for short-lived operations, callback implementations, goroutine creation, and situations where defining a named function would be overkill. They have access to variables in their enclosing scope, making them effective for creating closures. Common use cases include event handlers, sorting custom comparisons, and implementing functional programming patterns. Anonymous functions help keep code concise and localized when full function definitions aren't necessary.

View File

@@ -1 +1,3 @@
# Array to Slice Conversion
# Array to Slice Conversion
Convert arrays to slices using expressions like `array[:]` or `array[start:end]`. Creates slice header pointing to array memory - no data copying. Modifications through slice affect original array. Efficient way to use arrays with slice-based APIs.

View File

@@ -1 +1,3 @@
# Arrays
# Arrays
Arrays in Go are fixed-size sequences of elements of the same type. The size of an array is part of its type, meaning arrays of different sizes are considered different types. Arrays are declared with a specific length and all elements are initialized to the zero value of the element type. While arrays have their uses, slices are more commonly used in Go because of their flexibility. Arrays are value types, meaning they are copied when assigned or passed to functions. Understanding arrays is important for grasping Go's type system and the foundation for slices.

View File

@@ -1 +1,3 @@
# beego
# beego
Beego is a full-stack web framework providing MVC architecture, ORM, session management, caching, and admin interface generation. Follows convention over configuration with extensive tooling for rapid development of enterprise applications requiring comprehensive features.

View File

@@ -1 +1,3 @@
# Benchmarks
# Benchmarks
Benchmarks measure code performance by timing repeated executions. Functions start with `Benchmark` and use `*testing.B` parameter. Run with `go test -bench=.` to identify bottlenecks, compare implementations, and track performance changes over time.

View File

@@ -1 +1,3 @@
# Boolean
# Boolean
The `bool` type represents `true` or `false` values with default zero value of `false`. Essential for conditional logic, control flow, and binary states. Results from comparison (`==`, `!=`) and logical operations (`&&`, `||`, `!`).

View File

@@ -1 +1,3 @@
# break
# break
The `break` statement in Go immediately exits the innermost loop (for) or switch statement. In nested loops, break only exits the immediate loop unless used with a label to break out of outer loops. Labels allow you to specify which loop to break from, providing more control in complex nested structures. Break is essential for early loop termination when certain conditions are met, implementing search algorithms, and controlling loop flow based on runtime conditions. Understanding break helps you write more efficient loops that don't continue processing unnecessarily once their purpose is fulfilled.

View File

@@ -1 +1,3 @@
# bubbletea
# bubbletea
Bubble Tea is a framework for building terminal UIs based on The Elm Architecture. Uses model-update-view pattern for interactive CLI applications with keyboard input, styling, and component composition. Excellent for sophisticated terminal tools and dashboards.

View File

@@ -1 +1,3 @@
# Buffered vs Unbuffered
# Buffered vs Unbuffered
Channels in Go can be either buffered or unbuffered, which affects their synchronization behavior. Unbuffered channels (created with `make(chan Type)`) provide synchronous communication - the sender blocks until a receiver is ready, ensuring tight synchronization between goroutines. Buffered channels (created with `make(chan Type, capacity)`) allow asynchronous communication up to their capacity - senders only block when the buffer is full, and receivers only block when it's empty. Unbuffered channels are useful for coordination and ensuring operations happen in sequence, while buffered channels help with performance optimization and decoupling producer-consumer timing. Understanding this distinction is crucial for designing effective concurrent systems.

View File

@@ -1 +1,3 @@
# bufio
# bufio
The `bufio` package provides buffered I/O operations that wrap around existing `io.Reader` and `io.Writer` interfaces to improve performance. Buffered I/O reduces the number of system calls by reading or writing data in larger chunks. The package includes `Scanner` for convenient line-by-line reading, `Reader` for buffered reading with methods like `ReadLine()` and `ReadString()`, and `Writer` for buffered writing. It's particularly useful for processing large files, network operations, and any scenario where frequent small I/O operations would be inefficient. Understanding buffered I/O is important for building efficient applications that handle substantial amounts of data.

View File

@@ -1 +1,3 @@
# Build Constraints & Tags
# Build Constraints & Tags
Build constraints (also known as build tags) are special comments that control which files are included when building Go programs. They allow you to create platform-specific code, environment-specific builds, or feature toggles. Build constraints are placed at the top of Go files and use the `//go:build` directive (or the older `// +build` format). Common use cases include building different versions for different operating systems, architectures, or creating debug vs production builds. Understanding build constraints is essential for creating portable Go applications that can adapt to different environments and requirements.

View File

@@ -1 +1,3 @@
# Build Tags
# Build Tags
Build tags control file inclusion using `//go:build` directives based on conditions like OS, architecture, or custom tags. Enable conditional compilation for platform-specific code, feature flags, and environment-specific builds without runtime overhead.

View File

@@ -1 +1,3 @@
# Building CLIs
# Building CLIs
Go is an excellent choice for building command-line interface (CLI) applications due to its fast compilation, single binary distribution, and rich ecosystem of CLI libraries. You can build CLIs using the standard `flag` package for simple cases, or leverage powerful frameworks like Cobra (used by kubectl, Hugo), urfave/cli, or Bubble Tea for interactive applications. Go CLIs benefit from cross-compilation support, allowing you to build binaries for different platforms easily. Building CLIs is a great way to learn Go while creating useful tools for automation, development workflows, and system administration.

View File

@@ -1 +1,3 @@
# Building Executables
# Building Executables
The `go build` command compiles source code into standalone native executables with static linking. Creates self-contained binaries including all dependencies, requiring no Go installation on target systems. Control builds with various optimization flags.

View File

@@ -1 +1,3 @@
# Call by Value
# Call by Value
Go uses call by value for function arguments, meaning that when you pass a variable to a function, Go creates a copy of the value rather than passing the original variable. This applies to all types including integers, strings, structs, and arrays. For large data structures, this copying can be expensive, which is why pointers, slices, and maps (which contain references) are often used instead. Call by value provides safety by preventing functions from accidentally modifying the caller's data, but it also means that functions cannot modify the original values unless you explicitly pass pointers. Understanding this behavior is crucial for effective Go programming and performance optimization.

View File

@@ -1 +1,3 @@
# Capacity and Growth
# Capacity and Growth
Slice capacity determines when reallocation occurs during append operations. Go typically doubles capacity for smaller slices. Pre-allocate with `make([]T, length, capacity)` to optimize memory usage and minimize allocations in performance-critical code.

View File

@@ -1 +1,3 @@
# Centrifugo
# Centrifugo
Centrifugo is a real-time messaging server providing WebSocket services for Go applications. It offers channels, presence info, message history, and Redis scalability. Supports WebSocket, Server-Sent Events, and HTTP streaming while handling complex real-time patterns.

View File

@@ -1 +1,3 @@
# CGO Basics
# CGO Basics
CGO allows Go programs to call C code and vice versa using special comments. Enables C library integration but disables cross-compilation, reduces performance, and complicates deployment. Useful for legacy integration but pure Go is preferred.

View File

@@ -1 +1,3 @@
# Channels
# Channels
Channels are Go's primary mechanism for communication between goroutines, following the principle "Don't communicate by sharing memory; share memory by communicating." Channels are typed conduits that allow you to send and receive values between goroutines safely. They can be created using the `make()` function and come in two varieties: buffered and unbuffered. Channels can be used to synchronize goroutine execution, pass data between concurrent processes, and coordinate complex concurrent operations. Understanding channels is essential for writing effective concurrent programs in Go.

View File

@@ -1 +1,3 @@
# Closures
# Closures
Closures in Go are functions that capture and access variables from their surrounding scope, even after the outer function returns. They're created when a function references variables declared outside its body, "closing over" those variables. Closures are useful for creating specialized functions, implementing callbacks, maintaining state between function calls, and building factories or configuration functions. Since the captured variables remain accessible to the closure, they can be modified across multiple calls. This makes closures powerful for event handling, iterator patterns, and functional programming techniques. Understanding closures is important for writing flexible, reusable code and working with higher-order functions.

View File

@@ -1 +1,3 @@
# Cobra
# Cobra
Cobra is a powerful library for creating modern CLI applications in Go. It's used by many popular projects including Kubernetes (kubectl), Hugo, and GitHub CLI. Cobra provides features like nested subcommands, global and local flags, intelligent suggestions, automatic help generation, and shell completion. It follows POSIX standards and offers a clean API for building complex command-line interfaces. Cobra also includes a command generator to bootstrap CLI applications quickly. The library handles argument parsing, flag management, and help text generation automatically, allowing developers to focus on implementing command logic rather than CLI infrastructure.

View File

@@ -0,0 +1,3 @@
# Code Generation / Build Tags
Code generation with `go generate` automates boilerplate creation, while build tags enable conditional compilation for different platforms and environments. These tools help create flexible, maintainable applications with platform-specific implementations and feature flags without runtime overhead.

View File

@@ -0,0 +1,3 @@
# Code Quality and Analysis
Go provides tools for maintaining code quality including static analyzers, style checkers, and security scanners. Built-in tools like `go vet` provide basic analysis, while ecosystem tools like staticcheck and golangci-lint offer advanced checking for bugs, style, and security issues.

View File

@@ -1 +1,3 @@
# Comma-Ok Idiom
# Comma-Ok Idiom
Pattern for safely testing map key existence or type assertion success using `value, ok := map[key]` or `value, ok := interface.(Type)`. Returns both value and boolean status, preventing panics and distinguishing zero values from missing keys.

View File

@@ -1 +1,3 @@
# Commands & Docs
# Commands & Docs
Go provides built-in documentation tools including `go doc` for terminal documentation and `godoc` for web interface. Documentation uses special comments. `go help` provides command information. Essential for exploring standard library and writing well-documented code.

View File

@@ -1 +1,3 @@
# Common Usecases
# Common Usecases
Context package common uses: HTTP timeouts, database deadlines, goroutine cancellation coordination, and request-scoped values. Essential for web servers, microservices, circuit breakers, and building responsive APIs that handle cancellation gracefully.

View File

@@ -1 +1,3 @@
# Compiler & Linker Flags
# Compiler & Linker Flags
Build flags control compilation and linking. Common flags include `-ldflags` for linker options, `-gcflags` for compiler settings, `-tags` for build tags, and `-race` for race detection. Help optimize builds, reduce binary size, and embed build information.

View File

@@ -1 +1,3 @@
# Complex Numbers
# Complex Numbers
Built-in support with `complex64` and `complex128` types. Create using `complex()` function or literals like `3+4i`. Provides `real()`, `imag()`, `abs()` functions. Useful for mathematical computations, signal processing, and scientific applications.

View File

@@ -1 +1,3 @@
# Concurrency Patterns
# Concurrency Patterns
Concurrency patterns in Go are established design approaches for structuring concurrent programs using goroutines and channels. These patterns provide proven solutions for common concurrent programming challenges such as distributing work, aggregating results, and coordinating multiple processes. Key patterns include fan-in (merging multiple inputs), fan-out (distributing work to multiple workers), pipelines (chaining operations), worker pools (managing a fixed number of workers), and pub-sub (publisher-subscriber communication). Understanding these patterns helps you build efficient, scalable concurrent applications while avoiding common pitfalls like race conditions and deadlocks.

View File

@@ -1 +1,3 @@
# Conditionals
# Conditionals
Conditionals in Go allow your program to make decisions and execute different code paths based on certain conditions. Go provides `if` statements for basic conditional logic, `if-else` for binary decisions, and `switch` statements for multiple condition checking. The `if` statement can include an optional initialization statement, and conditions don't require parentheses but the body must be enclosed in braces. Go's `switch` statement is more powerful than in many languages, supporting expression switches, type switches, and fallthrough behavior. Conditionals are fundamental for controlling program flow and implementing business logic.

View File

@@ -1 +1,3 @@
# const and iota
# const and iota
Constants declared with `const` represent unchanging compile-time values. `iota` creates successive integer constants starting from zero, resetting per `const` block. Useful for enumerations, bit flags, and constant sequences without manual values.

View File

@@ -1 +1,3 @@
# `context` Package
# `context` Package
The `context` package provides a way to carry deadlines, cancellation signals, and request-scoped values across API boundaries and between processes. Context is essential for building robust concurrent applications, especially web services and APIs. It allows you to cancel long-running operations, set timeouts, and pass request-specific data through your application. The context is typically the first parameter of functions and is passed down through the call stack. Understanding context is crucial for writing production-ready Go applications that can handle cancellation, timeouts, and cleanup gracefully.

View File

@@ -1 +1,3 @@
# continue
# continue
The `continue` statement in Go skips the rest of the current iteration and jumps to the next iteration of the loop. It only affects the innermost loop unless used with labels to specify which loop to continue. Continue is useful for skipping processing of certain elements that don't meet specific criteria, implementing filtering logic within loops, and avoiding deeply nested conditional structures. It helps make loops more readable by handling special cases early and allowing the main logic to flow naturally. Understanding continue enables you to write cleaner, more efficient loops that focus on the elements that actually need processing.

View File

@@ -1 +1,3 @@
# Coverage
# Coverage
Test coverage measures code execution during testing using `go test -cover` and `-coverprofile`. Visualize with `go tool cover -html` to identify untested code paths. Helps maintain quality standards and guide testing efforts for more reliable applications.

View File

@@ -1 +1,3 @@
# Cross-compilation
# Cross-compilation
Build executables for different OS and architectures using `GOOS` and `GOARCH` environment variables. Example: `GOOS=linux GOARCH=amd64 go build` creates Linux binaries. Enables multi-platform development without separate build environments.

View File

@@ -1 +1,3 @@
# Data Types
# Data Types
Go has a rich set of built-in data types that form the foundation of all Go programs. These include basic types like integers (int8, int16, int32, int64), unsigned integers (uint8, uint16, uint32, uint64), floating-point numbers (float32, float64), complex numbers (complex64, complex128), booleans, strings, and runes (Unicode characters). Go is statically typed, meaning variable types are determined at compile time, which helps catch errors early and improves performance. Understanding Go's type system is crucial for writing efficient and reliable programs, as it affects memory usage, performance, and how you structure your data.

View File

@@ -1 +1,3 @@
# Deadlines & Cancellations
# Deadlines & Cancellations
Context package mechanisms for controlling operation lifetime and propagating cancellation signals. Supports deadlines (absolute time) or timeouts (duration). Functions should check `ctx.Done()` and return early when cancelled. Essential for robust concurrent applications.

View File

@@ -0,0 +1,3 @@
# Deployment & Tooling
Go deployment focuses on building optimized binaries for production. Static compilation creates self-contained executables, while cross-compilation builds for multiple platforms. Key aspects include containerization, configuration management, monitoring, and binary optimization for efficient production deployments.

View File

@@ -1 +1,3 @@
# echo
# echo
Echo is a high-performance, minimalist web framework for Go that focuses on ease of use and speed. It provides essential features for building APIs and web applications including optimized routing, middleware support, data binding, validation, and rendering. Echo's API is designed to be intuitive and requires minimal learning curve while offering powerful features like automatic TLS support, HTTP/2 support, and WebSocket handling. The framework includes built-in middleware for CORS, JWT authentication, logging, and compression. Echo is particularly popular for building RESTful APIs and microservices due to its excellent performance characteristics and comprehensive feature set.

View File

@@ -1 +1,3 @@
# Embedding Interfaces
# Embedding Interfaces
Interface embedding in Go allows you to create new interfaces by combining existing ones, promoting interface composition and reusability. When you embed an interface in another interface, the new interface automatically includes all methods from the embedded interface. This creates interface hierarchies and enables building complex interfaces from simpler, focused ones. Interface embedding supports the principle of composition over inheritance, allows for incremental interface definition, and helps create more maintainable and flexible designs. It's commonly used in standard library interfaces and is essential for building modular, extensible systems where interfaces can grow organically while maintaining backward compatibility.

View File

@@ -1 +1,3 @@
# Embedding Structs
# Embedding Structs
Struct embedding includes one struct inside another without field names, making embedded fields directly accessible. Provides composition-based design following Go's philosophy of composition over inheritance. Enables flexible, reusable components.

View File

@@ -1 +1,3 @@
# Empty Interfaces
# Empty Interfaces
Empty interfaces (`interface{}`) in Go can hold values of any type since they specify no methods. While powerful for creating flexible APIs and generic containers, they sacrifice compile-time type safety for runtime flexibility. With Go 1.18+, generics often provide a better alternative to empty interfaces for type-safe generic programming. Empty interfaces are still useful for scenarios like JSON unmarshaling, building general-purpose containers, implementing reflection-based libraries, and interfacing with dynamic systems. When using empty interfaces, you typically need type assertions or type switches to work with the actual values, so they should be used judiciously and with proper error handling.

View File

@@ -1 +1,3 @@
# Error Handling Basics
# Error Handling Basics
Error handling in Go follows an explicit approach where functions return an error as their last return value. Unlike languages that use exceptions, Go treats errors as values that must be explicitly checked and handled. The conventional pattern is to check if an error is nil (no error occurred) or handle the error appropriately. This approach makes error handling visible in the code flow and encourages developers to think about and handle potential failures at each step. Go's error handling philosophy emphasizes clarity and forces you to consider what should happen when things go wrong.

View File

@@ -1 +1,3 @@
# `error` interface
# `error` interface
Built-in interface with single `Error() string` method. Any type implementing this method can represent an error. Central to Go's error handling philosophy, providing consistent error representation across all Go code. Fundamental for effective error handling.

View File

@@ -1 +1,3 @@
# errors.New
# errors.New
Simplest way to create error values by taking a string message and returning an error implementing the error interface. Useful for simple, static error messages. Often combined with error wrapping or used for predefined error constants.

View File

@@ -1 +1,3 @@
# Escape Analysis
# Escape Analysis
Compile-time optimization determining whether variables are allocated on stack (fast) or heap (GC required). Variables that "escape" their scope need heap allocation. Use `go build -gcflags="-m"` to view decisions. Understanding helps minimize heap allocations and reduce GC pressure.

View File

@@ -1 +1,3 @@
# fan-in
# fan-in
Fan-in is a concurrency pattern where multiple input channels are merged into a single output channel. This pattern is useful for aggregating results from multiple goroutines, combining data streams, or centralizing processing from various sources. Implementation typically involves a function that starts goroutines to read from each input channel and forward values to a shared output channel. Fan-in helps simplify complex systems by providing a single point to collect distributed work results. It's commonly used in scenarios like distributed processing, load balancing, and event aggregation where you need to merge multiple concurrent data streams into one.

View File

@@ -1 +1,3 @@
# fan-out
# fan-out
Fan-out is a concurrency pattern where work from a single input channel is distributed to multiple worker goroutines for parallel processing. This pattern is effective for distributing computationally intensive tasks across multiple processors or handling high-throughput scenarios. Implementation involves multiple goroutines reading from the same input channel, with Go's runtime automatically distributing the work among available workers. Fan-out improves performance by leveraging parallelism and is particularly useful for CPU-bound tasks, batch processing, and scenarios where work can be processed independently. It's often combined with fan-in to collect results after parallel processing.

View File

@@ -1 +1,3 @@
# fiber
# fiber
Fiber is an Express-inspired web framework built on fasthttp for exceptional performance. Provides familiar API with middleware, routing, templates, and WebSocket support. Popular for high-performance REST APIs and microservices requiring speed and simplicity.

View File

@@ -1 +1,3 @@
# flag
# flag
The `flag` package provides command-line flag parsing functionality for Go programs. It supports various flag types including strings, integers, booleans, and durations, with automatic help generation and error handling. Flags can be defined using functions like `flag.String()`, `flag.Int()`, and `flag.Bool()`, and are parsed with `flag.Parse()`. The package handles both short and long flag formats, provides default values, and generates usage information automatically. While suitable for simple CLI applications, more complex command-line interfaces often benefit from libraries like Cobra or urfave/cli. Understanding the flag package is essential for creating basic command-line tools and scripts.

View File

@@ -1 +1,3 @@
# Floating Points
# Floating Points
Two types: `float32` (single precision) and `float64` (double precision, default). Represent real numbers using IEEE 754 standard. Can introduce precision errors, not suitable for exact financial calculations. Essential for scientific computing and graphics.

View File

@@ -1 +1,3 @@
# fmt.Errorf
# fmt.Errorf
Creates formatted error messages using printf-style verbs. Supports `%w` verb for error wrapping (Go 1.13+) to create error chains preserving original errors while adding context. Essential for descriptive errors with dynamic values and debugging information.

View File

@@ -1 +1,3 @@
# for loop
# for loop
The for loop is Go's only looping construct, but it's flexible enough to handle all iteration scenarios. The traditional three-component form `for init; condition; post` works like loops in other languages, while you can omit components for different behaviors. For example, omitting init and post creates a while-style loop, and omitting all components creates an infinite loop. The for loop is essential for repetitive operations, iterating over data structures, and implementing algorithms that require repeated execution. Its simplicity and versatility make it a fundamental tool for controlling program flow and processing collections of data.

View File

@@ -1 +1,3 @@
# for range
# for range
The `for range` loop in Go provides a convenient way to iterate over arrays, slices, maps, strings, and channels. It automatically handles iteration logic and provides access to both index/key and value for each element. When ranging over slices or arrays, you get index and value; over maps, you get key and value; over strings, you get byte index and rune value; and over channels, you get the received values. You can use the blank identifier `_` to ignore index/key if you only need values. The range loop is essential for processing collections and is more idiomatic and safer than manual index-based iteration in most cases.

View File

@@ -1 +1,3 @@
# Functions Basics
# Functions Basics
Function basics in Go cover the fundamental syntax and concepts for creating reusable code blocks. Functions are declared with the `func` keyword, followed by name, parameters in parentheses, optional return types, and the function body in braces. Go functions can have zero or more parameters, each with a specified type, and can return zero or more values. Function names that start with capital letters are exported (public), while lowercase names are unexported (private) to the package. Understanding function basics is essential for organizing code, creating modular programs, and following Go's conventions for code structure and visibility.

View File

@@ -1 +1,3 @@
# Functions
# Functions
Functions are the fundamental building blocks of Go programs that allow you to organize code into reusable pieces. In Go, functions are declared using the `func` keyword followed by the function name, parameters, return types, and function body. Functions can accept zero or more parameters, return zero or more values, and can be called from other parts of your program. Go functions have several unique features including multiple return values, named return values, variadic parameters, and first-class function support. Understanding functions is crucial for writing clean, maintainable, and efficient Go code.

View File

@@ -1 +1,3 @@
# Garbage Collection
# Garbage Collection
Go's GC automatically reclaims unreachable memory using concurrent, tri-color mark-and-sweep collector designed for minimal pause times. Runs concurrently with your program. Understanding GC helps write efficient programs that work well with automatic memory management.

View File

@@ -1 +1,3 @@
# Generic Functions
# Generic Functions
Write functions working with multiple types using type parameters in square brackets like `func FunctionName[T any](param T) T`. Enable reusable algorithms maintaining type safety. Particularly useful for utility functions and data processing that don't depend on specific types.

View File

@@ -1 +1,3 @@
# Generic Types / Interfaces
# Generic Types / Interfaces
Create reusable data structures and interface definitions working with multiple types. Define with type parameters like `type Container[T any] struct { value T }`. Enable type-safe containers, generic slices, maps, and custom structures while maintaining Go's strong typing.

View File

@@ -1 +1,3 @@
# Generics
# Generics
Generics, introduced in Go 1.18, allow you to write functions and types that can work with different data types while maintaining type safety. They enable you to create reusable code that doesn't sacrifice performance or type checking. With generics, you can write a single function or data structure that works with multiple types instead of having to duplicate code for each type. Generics use type parameters (written in square brackets) and type constraints to define which types are acceptable. This feature makes Go code more flexible and reduces code duplication while preserving the language's strong typing system.

View File

@@ -1 +1,3 @@
# gin
# gin
Gin is a popular HTTP web framework for Go that emphasizes performance and developer productivity. It provides a lightweight yet feature-rich foundation for building APIs and web services with minimal boilerplate code. Gin offers fast routing, middleware support, JSON validation, error management, and built-in rendering for JSON, XML, and HTML. Its API is clean and intuitive, making it easy to build RESTful services quickly. Gin includes useful features like parameter binding, file uploads, static file serving, and logging middleware. It's an excellent choice for developers who want more features than the standard library while maintaining high performance and simplicity.

View File

@@ -1 +1,3 @@
# go build
# go build
The `go build` command compiles Go packages and creates executable binaries. It reads Go source files, resolves dependencies, and produces optimized machine code for the target platform. The command can build single files, packages, or entire modules. By default, it creates an executable with the package name in the current directory. You can specify output names with `-o flag`, target different platforms with `GOOS` and `GOARCH` environment variables, and control various compilation options. Understanding `go build` is essential for creating deployable applications and optimizing build processes for different environments.

View File

@@ -1 +1,3 @@
# go clean
# go clean
Removes object files and cached files from build process. Options include `-cache` for build cache and `-modcache` for module downloads. Useful for troubleshooting build issues, freeing disk space, and ensuring clean builds.

View File

@@ -1 +1,3 @@
# `go` command
# `go` command
Primary tool for managing Go source code with unified interface for compiling, testing, formatting, and managing dependencies. Includes subcommands like `build`, `run`, `test`, `fmt`, `mod`. Handles the entire development workflow automatically.

View File

@@ -1 +1,3 @@
# go doc
# go doc
Prints documentation for Go packages, types, functions, and methods extracted from specially formatted comments. Use `go doc package` or `go doc package.Function` to view specific documentation. Essential for exploring APIs and verifying documentation formatting.

View File

@@ -1 +1,3 @@
# go fmt
# go fmt
The `go fmt` command automatically formats Go source code according to Go's official style guidelines. It standardizes indentation, spacing, alignment, and other formatting aspects to ensure consistent code style across all Go projects. The tool is opinionated and non-configurable, which eliminates debates about code formatting and ensures uniformity in the Go ecosystem. Most editors can be configured to run `go fmt` automatically on save. Using `go fmt` regularly keeps your code clean, readable, and consistent with Go community standards, making collaboration easier and code reviews more focused on logic rather than style.

View File

@@ -1 +1,3 @@
# go generate
# go generate
The `go generate` command executes commands specified in `//go:generate` directives to generate Go source code. Used for code generation from templates, string methods, embedded resources, and running tools like protobuf compilers for build automation.

View File

@@ -1 +1,3 @@
# go install
# go install
Compiles and installs packages and dependencies. Creates executables in `$GOPATH/bin` for main packages. Use `go install package@version` to install specific versions of tools. Commonly used for installing CLI tools system-wide.

View File

@@ -1 +1,3 @@
# go mod init
# go mod init
Initializes new Go module by creating `go.mod` file with specified module path (typically repository URL). Marks directory as module root and enables module-based dependency management. First step for any new Go project.

View File

@@ -1 +1,3 @@
# go mod tidy
# go mod tidy
Ensures `go.mod` matches source code by adding missing requirements and removing unused dependencies. Updates `go.sum` with checksums. Essential for maintaining clean dependency management and ensuring reproducible builds before production deployment.

View File

@@ -1 +1,3 @@
# go mod vendor
# go mod vendor
Creates `vendor` directory with dependency copies for bundling with source code. Ensures builds work without internet access. Useful for deployment, air-gapped environments, and complete control over dependency availability.

View File

@@ -1 +1,3 @@
# go mod
# go mod
The `go mod` command is the primary tool for managing Go modules and dependencies. It provides subcommands for initializing modules (`init`), adding dependencies (`get`), removing unused dependencies (`tidy`), creating vendor directories (`vendor`), and verifying dependencies (`verify`). The command works with `go.mod` and `go.sum` files to track module requirements and ensure reproducible builds. Understanding `go mod` is essential for modern Go development, as it handles dependency management, version resolution, and module publishing. It replaced the older GOPATH-based workflow and is fundamental for building maintainable Go projects.

View File

@@ -1 +1,3 @@
# go run
# go run
The `go run` command compiles and executes Go programs in a single step without creating a persistent binary file. It's perfect for development, testing small programs, and running scripts. When you use `go run main.go`, Go compiles the code to a temporary executable and runs it immediately, then cleans up the temporary files. This command is ideal for quick iterations during development, running one-off scripts, or testing code changes without the overhead of separate build steps. It accepts the same flags as `go build` and can run multiple files or entire packages.

View File

@@ -1 +1,3 @@
# go test
# go test
The `go test` command is Go's built-in tool for running tests, benchmarks, and examples. It automatically discovers test files (ending with `_test.go`), compiles them with the package code, and executes test functions. The command supports various flags for controlling test behavior, including `-v` for verbose output, `-run` for running specific tests, `-bench` for benchmarks, and `-cover` for coverage analysis. It can run tests in parallel, generate test coverage reports, and integrate with continuous integration systems. Mastering `go test` is crucial for maintaining code quality and implementing test-driven development practices.

View File

@@ -0,0 +1,3 @@
# Go Toolchain and Tools
The Go toolchain provides comprehensive development tools through the unified `go` command. It includes the compiler, linker, and utilities for compilation, dependency management, testing, and profiling. This integrated approach simplifies Go development with seamless, consistent tooling.

View File

@@ -1 +1,3 @@
# go version
# go version
Displays the currently installed Go version, target OS, and architecture. Essential for verifying installation, troubleshooting environment issues, and ensuring compatibility across different development environments and teams.

View File

@@ -1 +1,3 @@
# go vet
# go vet
Built-in tool analyzing Go source code for suspicious constructs likely to be bugs. Checks for unreachable code, incorrect printf formats, struct tag mistakes, and potential nil pointer dereferences. Automatically run by `go test`.

View File

@@ -1 +1,3 @@
# go:embed for embedding
# go:embed for embedding
The `go:embed` directive embeds files and directories into Go binaries at compile time using `//go:embed` comments. Useful for including static assets, configs, and templates directly in executables, creating self-contained binaries that don't require external files.

View File

@@ -1 +1,3 @@
# goimports
# goimports
Tool automatically managing Go import statements by adding missing imports and removing unused ones while formatting code. More convenient than manual import management, integrates with editors for automatic execution on save.

View File

@@ -1 +1,3 @@
# golangci-lint
# golangci-lint
Fast, parallel runner for multiple Go linters including staticcheck, go vet, and revive. Provides unified configuration, output formatting, and performance optimization. Streamlines code quality workflows through a single comprehensive tool.

View File

@@ -1 +1,3 @@
# GORM
# GORM
GORM is a feature-rich Object-Relational Mapping (ORM) library for Go that simplifies database interactions. It provides an intuitive API for database operations, automatic migrations, associations (belongs to, has one, has many, many to many), hooks (before/after create/save/update/delete), transactions, and connection pooling. GORM supports multiple databases including PostgreSQL, MySQL, SQLite, and SQL Server. It includes advanced features like soft deletes, composite primary keys, database resolver for read/write splitting, and plugin system for extensibility. While ORMs add abstraction overhead, GORM is excellent for rapid development and complex data relationships.

View File

@@ -1 +1,3 @@
# Goroutines
# Goroutines
Goroutines are lightweight threads managed by the Go runtime that enable concurrent execution of functions. They are one of Go's most powerful features, allowing you to run thousands or even millions of concurrent operations with minimal memory overhead. Goroutines are created simply by prefixing a function call with the `go` keyword. The Go runtime automatically handles scheduling goroutines across available CPU cores, making concurrent programming much easier than traditional threading models. Goroutines communicate through channels and are fundamental to Go's approach to concurrency and parallelism.

View File

@@ -1 +1,3 @@
# goto (discouraged)
# goto (discouraged)
The `goto` statement in Go allows jumping to labeled statements within the same function, but its use is strongly discouraged in modern Go programming. While goto exists for specific use cases like breaking out of nested loops or handling complex cleanup scenarios, it generally makes code harder to read, maintain, and debug. Go provides better alternatives like labeled break/continue statements, proper function decomposition, and structured control flow. Most situations where goto might seem necessary can be solved more elegantly with Go's other control structures. Understanding why goto is discouraged helps you write cleaner, more maintainable code that follows Go's philosophy of simplicity and clarity.

View File

@@ -1 +1,3 @@
# govulncheck
# govulncheck
Go's official vulnerability scanner checking code and dependencies for known security vulnerabilities. Reports packages with vulnerabilities from Go database, provides severity info and remediation advice. Essential for maintaining secure applications.

View File

@@ -1 +1,3 @@
# gRPC & Protocol Buffers
# gRPC & Protocol Buffers
gRPC is a high-performance RPC framework using Protocol Buffers for serialization. Provides streaming, authentication, load balancing, and code generation from `.proto` files. Excellent for microservices with type safety, efficient binary format, and cross-language compatibility.

View File

@@ -1 +1,3 @@
# Hello World in Go
# Hello World in Go
Traditional first program demonstrating basic structure: `package main`, importing `fmt`, and `main()` function using `fmt.Println()`. Teaches Go syntax, compilation, execution, and verifies development environment setup. Entry point for learning Go.

View File

@@ -1 +1,3 @@
# History of Go
# History of Go
Created at Google in 2007 by Griesemer, Pike, and Thompson. Announced publicly in 2009, version 1.0 in 2012. Key milestones include modules (Go 1.11) and generics (Go 1.18). Designed for large-scale software development combining efficiency and simplicity.

View File

@@ -1 +1,3 @@
# `httptest` for HTTP Tests
# `httptest` for HTTP Tests
The `httptest` package provides utilities for testing HTTP servers and clients without network connections. Includes `httptest.Server`, `ResponseRecorder`, and helpers for creating test requests. Essential for testing handlers, middleware, and HTTP services.

View File

@@ -1 +1,3 @@
# if-else
# if-else
The if-else statement in Go extends the basic if statement by providing an alternative code path when the condition is false. You can chain multiple conditions using else if to handle complex decision logic. Go's if-else maintains the same syntax rules as if statements - no parentheses required around conditions, but braces are mandatory around bodies. The else clause must be on the same line as the closing brace of the if block. If-else statements are essential for binary decisions, error handling patterns, and implementing branching logic where you need to choose between different execution paths based on conditions.

View File

@@ -1 +1,3 @@
# if
# if
The if statement in Go provides conditional execution of code blocks based on boolean expressions. Go's if statements don't require parentheses around conditions but must have braces around the body, even for single statements. A unique feature is the ability to include an initialization statement before the condition, which is useful for declaring variables with limited scope. If statements can be chained with else if and else clauses to handle multiple conditions. They're fundamental for controlling program flow, implementing business logic, and making decisions based on runtime conditions. Understanding if statements is essential for any Go program with conditional behavior.

View File

@@ -1 +1,3 @@
# Integers (Signed, Unsigned)
# Integers (Signed, Unsigned)
Signed integers (int8, int16, int32, int64) handle positive/negative numbers. Unsigned (uint8, uint16, uint32, uint64) handle only non-negative but larger positive range. `int`/`uint` are platform-dependent. Choose based on range and memory needs.

View File

@@ -1 +1,3 @@
# Interfaces Basics
# Interfaces Basics
Define contracts through method signatures. Types automatically satisfy interfaces by implementing required methods. Declared with `type InterfaceName interface{}` syntax. Enable polymorphism and flexible, testable code depending on behavior rather than concrete types.

View File

@@ -1 +1,3 @@
# Interfaces
# Interfaces
Interfaces in Go define a contract by specifying a set of method signatures that a type must implement. Unlike many other languages, Go interfaces are implemented implicitly - a type implements an interface simply by implementing all the methods declared in the interface. This approach promotes loose coupling and makes code more flexible and testable. Interfaces are central to Go's type system and enable polymorphism, allowing different types to be used interchangeably as long as they satisfy the same interface. They are essential for writing modular, extensible Go programs.

View File

@@ -1 +1,3 @@
# Interpreted String Literals
# Interpreted String Literals
Enclosed in double quotes (`"`) and process escape sequences like `\n`, `\t`, `\"`. Support Unicode characters and formatting. Most common string type, ideal for text needing control characters but requiring escaping of special characters.

View File

@@ -1 +1,3 @@
# Introduction to Go
# Introduction to Go
Go (also known as Golang) is a statically typed, compiled programming language developed by Google in 2007 and released in 2009. Created by Robert Griesemer, Rob Pike, and Ken Thompson, Go was designed to address the challenges of large-scale software development at Google. It combines the efficiency and safety of statically typed languages with the ease of programming of dynamically typed languages. Go emphasizes simplicity, readability, and efficiency, making it ideal for building scalable web services, cloud applications, and system tools. Its key features include fast compilation, garbage collection, built-in concurrency support, and a comprehensive standard library.

View File

@@ -1 +1,3 @@
# I/O & File Handling
# I/O & File Handling
Go's I/O system provides comprehensive file and stream handling through `io` package interfaces (Reader, Writer, Closer) and `os` package file operations. The interface-based design allows working with files, network connections, and buffers using consistent patterns.

View File

@@ -1 +1,3 @@
# Iterating Maps
# Iterating Maps
Iterating over maps in Go is done using the `for range` loop, which provides access to both keys and values. The iteration order is not guaranteed and can vary between runs, making maps unsuitable when order matters. You can iterate over keys only, values only, or both depending on your needs. Common patterns include checking if keys exist, building new collections from map data, and processing key-value pairs. When you need ordered iteration, you typically collect keys in a slice, sort them, and then iterate through the sorted keys to access map values in order.

Some files were not shown because too many files have changed in this diff Show More