Get in Touch

Course Outline

1. Introduction to Go

  • Overview of Go (Golang)
  • Historical background and design philosophy
  • Go as a language for web and systems programming
  • Key features:
    • Static typing
    • Emphasis on simplicity and readability
    • Rapid compilation
    • Native concurrency support
    • Automatic garbage collection
    • Cross-platform compilation capabilities
  • Typical use cases for Go
  • Strengths and constraints of the language
  • Comparison of Go with C/C++, JavaScript, Ruby, Python, and Java
  • Understanding the Go ecosystem
  • Overview of the standard library
  • Go modules and dependency management
  • Anatomy of a Go application
  • Hands-on: Examine and execute a basic Go program

2. Setting Up the Go Development Environment

  • Installation procedures for Go
  • Understanding the Go toolchain
  • Configuring necessary environment variables
  • Selecting an IDE or code editor
  • Using the command line for Go operations
  • Setting up a Go workspace
  • Understanding Go project structure
  • Initializing a project using Go Modules
  • Using go mod init
  • Managing dependencies with go get
  • Updating and verifying dependencies
  • Formatting source code using gofmt
  • Executing 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

  • Declaring variables
  • Explicit types versus type inference
  • Short variable declaration syntax
  • Defining constants
  • Understanding zero values
  • Variable scope and lifetime
  • Primitive data types:
    • Integers
    • Floating-point numbers
    • Complex numbers
    • Boolean values
    • Strings
  • Type conversion techniques
  • Handling Unicode and UTF-8
  • Working with runes and bytes
  • Multiple variable assignment
  • Understanding type safety mechanisms
  • Exercise: Develop a simple command-line data-processing program

4. Operators and Expressions

  • Arithmetic operators
  • Comparison operators
  • Logical operators
  • Assignment operators
  • Increment and decrement operations
  • Operator precedence rules
  • Performing integer and floating-point calculations
  • Preventing common type-conversion errors
  • Exercise: Implement calculation and validation logic

5. Dates, Times and Formatting

  • Utilizing the time package
  • Creating and manipulating date objects
  • Retrieving the current time
  • Managing time zones and locations
  • Parsing date and time strings
  • Formatting output for dates and times
  • Calculating time durations
  • Working with Unix timestamps
  • Implementing timeouts
  • Exercise: Integrate timestamps and duration calculations into an application

6. Arrays, Slices, Maps and Structs

Arrays

  • Array declaration
  • Initialization methods
  • Iterating through arrays
  • Working with multidimensional arrays

Slices

  • Distinguishing slices from arrays
  • Creating new slices
  • Appending elements to slices
  • Copying slice data
  • Understanding slice length and capacity
  • Slicing existing slices
  • Avoiding common slice-related pitfalls

Maps

  • Creating map instances
  • Adding and deleting entries
  • Checking for key existence
  • Iterating over map contents
  • Storing complex data structures in maps

Structs

  • Defining custom structures

  • Working with struct fields

  • Initializing struct instances

  • Nested struct definitions

  • Using anonymous structs

  • Defining struct methods

  • Applying JSON struct tags

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

7. Conditional Logic and Loops

  • Using if statements
  • Implementing else and else if conditions
  • Declaring variables within conditional blocks
  • Using for loops
  • Creating infinite loops
  • Defining loop termination conditions
  • Using break and continue statements
  • Iterating with range
  • Nested loop structures
  • Using switch statements
  • Expression-based switch cases
  • Handling multiple cases
  • Defining default cases
  • Implementing type switches
  • Exercise: Implement application validation and processing logic

8. Functions

  • Function definition syntax
  • Handling function parameters
  • Returning values
  • Multiple return values
  • Named return values
  • Variadic function arguments
  • Anonymous (closure) functions
  • Using functions as values
  • Working with closures
  • Recursive function calls
  • Passing functions as arguments
  • Functions that return errors
  • Designing small, reusable functions
  • Exercise: Refactor existing code into reusable functional units

9. Pointers and Memory Concepts

  • Concept of pointers
  • Address-of and dereference operators
  • Pointers in function parameters
  • Pointer receivers in methods
  • Pointers to struct instances
  • Understanding nil pointers
  • Best practices for pointer usage
  • Value versus reference semantics
  • Go's memory management and garbage collection
  • Common pointer-related errors
  • Hands-on: Modify application data structures using pointers

10. Creating a Web Application in Go

  • Overview of Go's web development capabilities
  • Introduction to the net/http package
  • Setting up an HTTP server
  • Handling HTTP requests and responses
  • Understanding HTTP methods
  • Parsing request URLs and query parameters
  • Managing HTTP headers
  • Interpreting HTTP status codes
  • Routing basics
  • Implementing request handlers
  • Processing form data
  • Serving static assets
  • Working with HTML templates
  • Template variables and logic control
  • Architecting a web application
  • Hands-on: Build a foundational Go web server

11. Building a RESTful Web Service

  • Core concepts of REST architecture
  • Designing API endpoints
  • Implementing GET, POST, PUT, PATCH, and DELETE
  • Working with JSON data
  • JSON encoding and decoding
  • Validating incoming requests
  • Managing HTTP status codes
  • Constructing error responses
  • Handling query and path parameters
  • Structuring API responses
  • Separating handlers from business logic
  • Hands-on: Build a CRUD REST API

12. Go Runtime, Compilation and Project Builds

  • Understanding the Go compiler
  • The Go build process
  • Using go run
  • Using go build
  • Using go install
  • Using go test
  • Configuring build flags
  • Environment-specific configuration
  • Building for various operating systems and architectures
  • Generating standalone binaries
  • Managing application configuration files
  • Exercise: Compile the application for multiple target platforms

13. Working with Files and the Web

  • Opening and closing file handles
  • Reading file contents
  • Writing data to files
  • Creating directory structures
  • Accessing file metadata
  • Using buffered I/O
  • Handling data streams
  • Reading and writing JSON files
  • Implementing HTTP clients
  • Making outbound HTTP requests
  • Handling client-side errors
  • Setting timeouts and cancellation signals
  • Processing API responses
  • Hands-on: Fetch data from an external API and store it locally

14. Error Handling and Debugging

  • Go's philosophy on error handling
  • Returning errors from functions
  • Checking for error conditions
  • Creating custom error types
  • Wrapping errors for context
  • Adding contextual information to errors
  • Using errors.Is and errors.As
  • Panic and recovery mechanisms
  • Appropriate use of panic
  • Debugging common Go issues
  • Logging application activities
  • Utilizing Go debugging tools
  • Exercise: Diagnose and resolve intentionally introduced application errors

15. Interfaces and Abstraction

  • Definition of interfaces
  • Implicit interface satisfaction
  • Declaring custom interfaces
  • Interface values
  • Empty interfaces and the any type
  • Type assertions
  • Type switching logic
  • Pointer versus value receiver implementations
  • Designing granular interfaces
  • Dependency inversion principle
  • Leveraging interfaces for testability
  • Reducing coupling in applications
  • Hands-on: Integrate interfaces into the sample web application

16. Packages and Project Organization

  • Creating new packages
  • Package naming best practices
  • Exported versus unexported identifiers
  • Importing external packages
  • Package initialization sequences
  • Structuring application layers
  • Using internal packages
  • Dependency management via Go Modules
  • Applying semantic versioning
  • Incorporating third-party libraries
  • Preventing circular dependencies
  • Designing maintainable Go projects
  • Exercise: Refactor the application into distinct packages

17. Concurrency with Goroutines

  • Concepts of concurrency
  • Introduction to Goroutines
  • Spawning goroutines
  • Understanding lightweight concurrent execution
  • Synchronization requirements
  • Managing shared state
  • Preventing race conditions
  • Using sync.WaitGroup
  • Implementing mutexes and read/write mutexes
  • Performing atomic operations
  • Hands-on: Transform a sequential task into a concurrent process

18. Channels

  • Understanding channels
  • Sending and receiving data through channels
  • Buffered versus unbuffered channels
  • Blocking behavior in channels
  • Closing channels safely
  • Iterating over channels
  • Directional channel types
  • Channel-based communication patterns
  • Using select statements
  • Handling timeouts and cancellation via channels
  • Implementing worker-pool patterns
  • Implementing producer/consumer patterns
  • Hands-on: Build a concurrent worker system

19. Context and Request Management

  • Importance of context in web applications
  • Using context.Context
  • Request-scoped contexts
  • Implementing cancellation signals
  • Setting deadlines
  • Managing timeouts
  • Propagating context across application layers
  • Cancelling database or HTTP operations
  • Avoiding common context usage errors
  • Exercise: Add request cancellation and timeout support to the web application

20. Testing Go Applications

  • Significance of automated testing
  • Writing unit tests
  • Using the testing package
  • Defining test functions
  • Following test naming conventions
  • Writing table-driven tests
  • Testing error handling paths
  • Testing HTTP handlers
  • Using HTTP test servers
  • Setting up test fixtures
  • Measuring test coverage
  • Writing benchmarks
  • Writing example tests
  • Mocking or faking interfaces for testing
  • Hands-on: Create a comprehensive test suite for the sample application

21. Performance Optimization

  • Assessing Go application performance
  • Identifying performance bottlenecks
  • Optimizing CPU versus memory usage
  • Selecting efficient data structures
  • Minimizing unnecessary memory allocations
  • Efficient handling of strings, bytes, and buffers
  • Managing goroutine overhead
  • Avoiding excessive concurrency
  • Implementing caching strategies
  • Optimizing database and network interactions
  • Profiling application performance
  • Running benchmarks and performance tests
  • Utilizing Go's built-in profiling tools
  • Exercise: Profile and optimize a deliberately inefficient application

22. Security and Robust Web Application Practices

  • Validating user input
  • Secure handling of HTTP requests
  • Preventing common web vulnerabilities
  • Secure error message handling
  • Authentication and authorization principles
  • Managing secrets and configuration securely
  • Implementing secure HTTP communication
  • Preventing sensitive data leakage in logs
  • Dependency security and updates
  • Setting resource limits and request timeouts
  • Exercise: Review and harden the sample API

23. Application Logging and Observability

  • Foundations of logging
  • Implementing structured logging
  • Managing log levels
  • Logging HTTP requests
  • Logging errors
  • Using correlation and request IDs
  • Monitoring application behavior
  • Collecting basic metrics
  • Implementing health-check endpoints
  • Diagnosing production issues
  • Hands-on: Add structured logging and health checks to the application

24. Containerizing the Go Application

  • Benefits of containerization
  • Go applications and container workflows
  • Writing a Dockerfile
  • Using multi-stage builds
  • Creating minimal runtime images
  • Managing configuration via environment variables
  • Container networking basics
  • Exposing application ports
  • Running the application in a container
  • Testing the containerized build
  • Hands-on: Package the sample Go application as a production-ready container

25. Deployment

  • Preparing the application for production
  • Building optimized production binaries
  • Configuring the production environment
  • Implementing container-based deployment
  • Designing deployment architecture
  • Configuring reverse proxies
  • HTTPS/TLS security considerations
  • Implementing application health checks
  • Implementing graceful shutdown
  • Handling operating-system signals
  • Scaling Go web applications
  • Horizontal versus vertical scaling strategies
  • Basic deployment troubleshooting
  • Hands-on: Deploy the sample web application to a production environment

26. Capstone: Complete Go Web Application

Participants consolidate their knowledge by developing a complete, functional application.

The project may include:

  • Project initialization using Go Modules
  • Logical package organization
  • HTTP routing configuration
  • Implementation of REST API endpoints
  • JSON request and response handling
  • Input validation mechanisms
  • Robust error handling
  • Interface implementation
  • Concurrent processing patterns
  • External API integration
  • Persistence using files or databases
  • Automated testing suites
  • Structured logging
  • Performance optimization
  • Containerization
  • Production configuration setup
  • Final deployment steps

27. Review and Best Practices

  • Review of core Go syntax
  • Adhering to Go coding conventions
  • Writing idiomatic Go code
  • Keeping code simple and clear
  • Effective package design strategies
  • Error-handling best practices
  • Principles of interface design
  • Concurrency best practices
  • Effective testing strategies
  • Performance considerations
  • Maintainability and readability standards
  • Common pitfalls for new Go developers
  • Recommended next steps for continued Go development

28. Conclusion

  • Recap of key concepts
  • Review of the completed web application
  • Q&A and discussion session
  • Troubleshooting common real-world scenarios
  • Recommended next steps for Go development
  • Exploration of additional Go libraries and ecosystem resources
  • Opportunities for building production-grade Go services

Requirements

  • Familiarity with fundamental programming principles

Target Audience

  • Software Developers
 28 Hours

Number of participants


Price per participant

Testimonials (5)

Provisional Upcoming Courses (Require 5+ participants)

Related Categories