Get in Touch

Course Outline

1. Introduction to Go

  • Definition of Go (Golang)
  • Historical context and design philosophy
  • Go in web and systems programming
  • Core characteristics:
    • Static typing
    • Simplicity and readability
    • Rapid compilation
    • Native concurrency
    • Garbage collection
    • Cross-platform compatibility
  • Typical use cases
  • Strengths and constraints
  • Comparison with C/C++, JavaScript, Ruby, Python, and Java
  • The Go ecosystem
  • Standard library overview
  • Modules and dependency management
  • Structure of a Go application
  • Hands-on: Examine and execute a simple Go program

2. Setting Up the Go Development Environment

  • Installation of Go
  • The Go toolchain
  • Environment variable configuration
  • Selecting an IDE or code editor
  • Command-line operations in Go
  • Creating a Go workspace
  • Project structure fundamentals
  • Project initialization via Go Modules
  • Utilizing go mod init
  • Managing dependencies with go get
  • Updating and reviewing dependencies
  • Formatting source code using gofmt
  • Running programs with go run
  • Building applications with go build
  • Installing Go applications
  • Cross-compilation techniques
  • Hands-on: Create and configure a Go project within a container

3. Go Variables, Constants, and Types

  • Variable declaration
  • Explicit vs. inferred types
  • Short variable declarations
  • Constants
  • Zero values
  • Variable scope and lifetime
  • Primitive data types:
    • Integers
    • Floating-point numbers
    • Complex numbers
    • Booleans
    • Strings
  • Type conversions
  • Unicode and UTF-8 handling
  • Runes and bytes
  • Multiple variable assignment
  • Type safety concepts
  • Exercise: Develop a small command-line data processing tool

4. Operators and Expressions

  • Arithmetic operators
  • Comparison operators
  • Logical operators
  • Assignment operators
  • Increment and decrement
  • Operator precedence
  • Integer and floating-point calculations
  • Avoiding type conversion errors
  • Exercise: Implement calculation and validation logic

5. Dates, Times, and Formatting

  • Utilizing the time package
  • Date creation and manipulation
  • Retrieving current time
  • Time zones and locations
  • Parsing dates and times
  • Formatting dates and times
  • Duration calculations
  • Unix timestamps
  • Timeout handling
  • Exercise: Integrate timestamps and duration calculations into an application

6. Arrays, Slices, Maps, and Structs

Arrays

  • Array declaration
  • Array initialization
  • Iterating over arrays
  • Multidimensional arrays

Slices

  • Slices vs. arrays
  • Creating slices
  • Appending elements
  • Copying slices
  • Length and capacity
  • Slicing slices
  • Common slice pitfalls

Maps

  • Creating maps
  • Adding and removing entries
  • Key existence checks
  • Iterating over maps
  • Maps with complex data

Structs

  • Defining structures

  • Struct fields

  • Initializing structs

  • Nested structs

  • Anonymous structs

  • Struct methods

  • JSON struct tags

  • Hands-on: Model users, products, and application data using structs, slices, and maps

7. Conditional Logic and Loops

  • if statements
  • else and else if
  • Variable declarations within conditions
  • for loops
  • Infinite loops
  • Loop conditions
  • break and continue
  • Iterating with range
  • Nested loops
  • switch statements
  • Expression-based switches
  • Multiple cases
  • Default cases
  • Type switches
  • Exercise: Implement application validation and processing logic

8. Functions

  • Function definition
  • Parameters
  • Return values
  • Multiple return values
  • Named return values
  • Variadic functions
  • Anonymous functions
  • Function values
  • Closures
  • Recursion
  • Passing functions as arguments
  • Error-returning functions
  • Designing small, reusable functions
  • Exercise: Refactor existing code into reusable functions

9. Pointers and Memory Concepts

  • Pointer fundamentals
  • Address-of and dereference operators
  • Pointers and function parameters
  • Pointer receivers
  • Pointers to structs
  • Nil pointers
  • Use cases for pointers
  • Value vs. reference semantics
  • Go memory management and garbage collection
  • Common pointer errors
  • Hands-on: Modify application data using pointers

10. Creating a Web Application in Go

  • Go's web capabilities
  • The net/http package
  • Creating an HTTP server
  • HTTP requests and responses
  • HTTP methods
  • Request URLs and query parameters
  • HTTP headers
  • HTTP status codes
  • Routing basics
  • Creating handlers
  • Handling form data
  • Serving static files
  • HTML templates
  • Template variables and control structures
  • Structuring web applications
  • Hands-on: Build a basic Go web server

11. Building a RESTful Web Service

  • REST architecture basics
  • API endpoint design
  • GET, POST, PUT, PATCH, and DELETE
  • JSON handling
  • JSON encoding and decoding
  • Request validation
  • HTTP status codes
  • Error responses
  • Query and path parameters
  • API response structures
  • Separating handlers from business logic
  • Hands-on: Build a CRUD REST API

12. Go Runtime, Compilation, and Project Builds

  • The Go compiler
  • Build process
  • go run
  • go build
  • go install
  • go test
  • Build flags
  • Environment-specific configuration
  • Building for different OS and architectures
  • Standalone binaries
  • Application configuration management
  • Exercise: Compile the application for multiple platforms

13. Working with Files and the Web

  • Opening and closing files
  • Reading files
  • Writing files
  • Creating directories
  • File metadata
  • Buffered I/O
  • Stream processing
  • Reading and writing JSON files
  • HTTP clients
  • Outbound HTTP requests
  • Handling HTTP client errors
  • Timeouts and cancellation
  • Processing API responses
  • Hands-on: Retrieve data from an external API and store it locally

14. Error Handling and Debugging

  • Go's error approach
  • Returning errors from functions
  • Error checking
  • Custom errors
  • Wrapping errors
  • Adding context to errors
  • errors.Is and errors.As
  • Panic and recovery
  • Appropriate use of panic
  • Debugging common Go issues
  • Application logging
  • Go debugging tools
  • Exercise: Diagnose and fix intentionally introduced application errors

15. Interfaces and Abstraction

  • Interface concepts
  • Implicit interface implementation
  • Defining interfaces
  • Interface values
  • Empty interfaces / any
  • Type assertions
  • Type switches
  • Pointer vs. value implementations
  • Designing small interfaces
  • Dependency inversion
  • Interfaces for testing
  • Reducing application coupling
  • Hands-on: Integrate interfaces into the sample web application

16. Packages and Project Organization

  • Creating packages
  • Naming conventions
  • Exported vs. unexported identifiers
  • Importing packages
  • Package initialization
  • Organizing application layers
  • Internal packages
  • Dependency management with Go Modules
  • Semantic versioning
  • Third-party packages
  • Avoiding circular dependencies
  • Designing maintainable Go projects
  • Exercise: Refactor the application into separate packages

17. Concurrency with Goroutines

  • Concurrency concepts
  • Goroutines
  • Starting goroutines
  • Lightweight concurrent execution
  • Synchronization challenges
  • Shared state
  • Race conditions
  • Using sync.WaitGroup
  • Mutexes and read/write mutexes
  • Atomic operations
  • Hands-on: Convert sequential tasks into concurrent processing

18. Channels

  • Channel concepts
  • Sending and receiving values
  • Buffered vs. unbuffered channels
  • Blocking behavior
  • Closing channels
  • Ranging over channels
  • Directional channels
  • Channel-based communication
  • Select statements
  • Timeouts and cancellation
  • Worker-pool patterns
  • Producer/consumer patterns
  • Hands-on: Build a concurrent worker system

19. Context and Request Management

  • Importance of context in web apps
  • context.Context
  • Request-scoped context
  • Cancellation
  • Deadlines
  • Timeouts
  • Propagating context through layers
  • Cancelling database or HTTP operations
  • Avoiding context misuse
  • Exercise: Add request cancellation and timeouts to the web application

20. Testing Go Applications

  • Importance of automated testing
  • Writing unit tests
  • The testing package
  • Test functions
  • Test naming conventions
  • Table-driven tests
  • Testing errors
  • Testing HTTP handlers
  • HTTP test servers
  • Test fixtures
  • Test coverage
  • Benchmarks
  • Example tests
  • Testing interfaces with mocks or fakes
  • Hands-on: Create a test suite for the sample application

21. Performance Optimization

  • Understanding Go performance
  • Identifying bottlenecks
  • CPU vs. memory performance
  • Efficient data structures
  • Reducing unnecessary allocations
  • Strings, bytes, and buffers
  • Goroutine management
  • Avoiding excessive concurrency
  • Caching strategies
  • Database and network considerations
  • Application profiling
  • Benchmarks and performance testing
  • Go profiling tools
  • Exercise: Profile and optimize a deliberately inefficient application

22. Security and Robust Web Application Practices

  • User input validation
  • Safe HTTP request handling
  • Preventing common web vulnerabilities
  • Secure error handling
  • Authentication and authorization
  • Managing secrets and configuration
  • Secure HTTP communication
  • Avoiding sensitive info in logs
  • Dependency management and updates
  • Resource limits and request timeouts
  • Exercise: Review and harden the sample API

23. Application Logging and Observability

  • Logging fundamentals
  • Structured logging
  • Log levels
  • Request logging
  • Error logging
  • Correlation and request IDs
  • Monitoring application behavior
  • Basic metrics
  • Health-check endpoints
  • Diagnosing production issues
  • Hands-on: Add structured logging and health checks

24. Containerizing the Go Application

  • Benefits of containers
  • Go and containerization
  • Writing a Dockerfile
  • Multi-stage builds
  • Minimal runtime images
  • Configuration via environment variables
  • Container networking
  • Exposing application ports
  • Running in a container
  • Testing containerized apps
  • Hands-on: Package the sample Go application as a production-ready container

25. Deployment

  • Production preparation
  • Building production binaries
  • Environment configuration
  • Container-based deployment
  • Deployment architecture
  • Reverse proxies
  • HTTPS/TLS considerations
  • Application health checks
  • Graceful shutdown
  • Handling OS signals
  • Scaling Go web applications
  • Horizontal vs. vertical scaling
  • Basic deployment troubleshooting
  • Hands-on: Deploy the sample web application

26. Capstone: Complete Go Web Application

Participants consolidate their learning by developing a complete application.

The project may include:

  • Project initialization with Go Modules
  • Package organization
  • HTTP routing
  • REST API endpoints
  • JSON request and response handling
  • Input validation
  • Error handling
  • Interfaces
  • Concurrent processing
  • External API communication
  • File or database persistence
  • Automated tests
  • Logging
  • Performance considerations
  • Containerization
  • Production configuration
  • Deployment

27. Review and Best Practices

  • Review of core Go syntax
  • Go coding conventions
  • Writing idiomatic Go
  • Simplicity in code
  • Effective package design
  • Error-handling best practices
  • Interface design principles
  • Concurrency best practices
  • Testing strategies
  • Performance considerations
  • Maintainability and readability
  • Common mistakes by new Go developers
  • Approaches for continued Go development

28. Conclusion

  • Review of key concepts
  • Review of the completed web application
  • Questions and discussion
  • Troubleshooting common real-world scenarios
  • Recommended next steps for Go development
  • Additional Go libraries and ecosystem resources
  • Further opportunities for building production-grade Go services

Requirements

  • Familiarity with general programming principles

Audience

  • Developers
 28 Hours

Number of participants


Price per participant

Testimonials (5)

Upcoming Courses

Related Categories