Skip to content

Latest commit

 

History

History
134 lines (111 loc) · 3.57 KB

README.MD

File metadata and controls

134 lines (111 loc) · 3.57 KB

Go Learning Examples

This directory contains various Go examples to help you learn the language step by step.

Examples Overview

  1. Introduction

    • Introduction to Go
    • Installation & setup
    • Initialization & running a Go program
  2. Constant, Variables, and Types

    • Basic data types
    • Variable declaration
    • Constants
  3. Printing & formatting

    • Printing to console
    • Formatting strings
  4. Arrays, Slices, and Maps

    • Fixed-length arrays
    • Dynamic slices
    • Key-value maps
  5. Control Flow

    • If/else statements
    • Switch cases
    • Loops (for, range)
    • Control statements (break, continue)
  6. Functions

    • Basic function syntax
    • Multiple return values
    • Variadic functions
    • Defer statements
    • Closures
    • Recursion
    • Anonymous functions
  7. Error Handling

    • The error interface
    • Constructing basic errors
    • Expected (sentinel) errors
    • Custom error types
    • Error handling best practices
    • Panic and Recover
  8. Structs

    • Basic function syntax
    • Custom Types
  9. Methods and Interface

    • Methods
    • Interface
  10. Packages and Modules

    • Package organization
    • Module management
    • Local/remote imports
    • Semantic versioning
  11. Basic Miscellaneous

    • Type Casting
    • Type Inference
    • Type Assertions
    • Type Switches
    • Maps and Make
    • Pointers
    • Generics
  12. Concurrency

    • Goroutines
    • Channels (Buffered and Unbuffered)
    • Select Statement
    • Synchronization (WaitGroup, Mutex)
  13. File I/O and Working with JSON

    • File I/O
    • Working with JSON
    • JSON Marshalling and Unmarshalling
    • JSON Encoding and Decoding
  14. Testing

    • Writing tests
    • Test Driven Development
    • Package testing
    • Table-driven tests
  15. Command line interfaces

    • Basic CLI
    • Flags
    • Subcommands
    • Parsing arguments
  16. Web Development

    • HTTP Server
      • basic server
      • multiplexing
      • multiple server configuration
    • HTTP Client
      • basic client
      • request and response
      • error handling
  17. Database

    • SQLite
      • basic database
      • CRUD operations
      • error handling
      • advanced
        • Advanced
          • CRUD operations
          • Context
          • error handling
          • best practices
          • transactions
          • testing

How to Run Examples

  1. Navigate to the specific example directory
  2. Read the comments in the code for explanation
  3. Run the program using:
    go run main.go

Tips for Beginners

  • Take time to understand each concept before moving to the next
  • Try to modify the examples to experiment with the code
  • Use go doc command to read documentation
  • Practice writing your own programs using learned concepts