Get in Touch

Course Outline

1. Introduction to Go

  • Defining Go (Golang)
  • The history and design principles behind Go
  • Go as a language for web and systems programming
  • Core characteristics:
    • Static typing
    • Emphasis on simplicity and readability
    • Rapid compilation speeds
    • Native support for concurrency
    • Automatic garbage collection
    • Cross-platform compilation capabilities
  • Typical use cases for Go
  • Benefits and limitations of the Go language
  • Comparing Go with C/C++, JavaScript, Ruby, Python, and Java
  • Overview of the Go ecosystem
  • Summary of the Go standard library
  • Go modules and dependency management strategies
  • Structure and anatomy of a Go application
  • Practical Task: Inspect and execute a basic Go program

2. Configuring the Go Development Environment

  • Installing the Go toolchain
  • Understanding the components of the Go toolchain
  • Setting necessary environment variables
  • Selecting an appropriate IDE or code editor
  • Interacting with Go via the command line
  • Establishing a Go workspace
  • Understanding the standard Go project structure
  • Initializing a new project using Go Modules
  • Utilizing go mod init
  • Managing dependencies using go get
  • Updating and reviewing dependencies
  • Formatting source code with gofmt
  • Executing programs via go run
  • Compiling applications using go build
  • Installing Go applications locally
  • Cross-compiling for different platforms
  • Practical Task: Create and configure a Go project within a containerized environment

3. Variables, Constants, and Data Types in Go

  • Variable declaration methods
  • Distinguishing between explicit and inferred types
  • Using short variable declarations
  • Working with constants
  • Concept of zero values
  • Variable scope and lifetime
  • Primitive data types:
    • Integers
    • Floating-point numbers
    • Complex numbers
    • Boolean values
    • String literals
  • Type conversion techniques
  • Handling Unicode and UTF-8 encoding
  • Differences between runes and bytes
  • Assigning multiple variables simultaneously
  • Understanding type safety in Go
  • Exercise: Develop a simple command-line data processing utility

4. Operators and Expressions

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

5. Handling Dates, Times, and Formatting

  • Utilizing the time package
  • Creating and manipulating date objects
  • Retrieving the current system time
  • Managing time zones and locations
  • Parsing date and time strings
  • Formatting dates and times for output
  • 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

  • Declaring array structures
  • Initializing arrays with values
  • 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 vs. capacity
  • Reslicing existing slices
  • Avoiding common pitfalls with slices

Maps

  • Initializing map structures
  • Inserting and deleting map entries
  • Verifying the existence of keys
  • Iterating over map contents
  • Maps storing complex data structures

Structs

  • Defining struct types

  • Struct field definitions

  • Initializing struct instances

  • Nested struct definitions

  • Using anonymous structs

  • Defining methods for structs

  • Applying JSON tags to structs

  • Practical Task: Model users, products, and application data using structs, slices, and maps

7. Conditional Logic and Loops

  • if statement syntax
  • Using else and else if blocks
  • Declaring variables within conditional statements
  • for loop structures
  • Creating infinite loops
  • Defining loop conditions
  • Using break and continue
  • Iterating using range
  • Nested loop implementations
  • switch statement usage
  • Expression-based switching
  • Handling multiple cases
  • Defining default cases
  • Type-specific switches
  • Exercise: Implement validation and processing logic for an application

8. Functions in Go

  • Defining function signatures
  • Managing function parameters
  • Handling return values
  • Returning multiple values
  • Named return values
  • Variadic function parameters
  • Anonymous functions (closures)
  • 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 modular, reusable functions

9. Pointers and Memory Concepts

  • Understanding pointer fundamentals
  • Address-of and dereference operators
  • Pointers as function parameters
  • Pointer receivers in methods
  • Pointers to struct instances
  • Handling nil pointers
  • Best practices for pointer usage
  • Distinguishing value vs. reference semantics
  • Go's memory management and garbage collection
  • Common errors associated with pointers
  • Practical Task: Modify application data using pointer references

10. Developing Web Applications with Go

  • Overview of Go's web development capabilities
  • Introduction to the net/http package
  • Setting up an HTTP server
  • Processing HTTP requests and responses
  • Understanding HTTP methods
  • Handling request URLs and query parameters
  • Managing HTTP headers
  • Interpreting HTTP status codes
  • Basics of request routing
  • Creating request handlers
  • Processing form data submissions
  • Serving static assets
  • Working with HTML templates
  • Template variables and control flow
  • Structuring a web application codebase
  • Practical Task: Build a basic Go web server

11. Building RESTful Web Services

  • Fundamentals of REST architecture
  • Designing API endpoints
  • Implementing GET, POST, PUT, PATCH, and DELETE methods
  • Working with JSON data formats
  • Encoding and decoding JSON payloads
  • Validating incoming requests
  • Using appropriate HTTP status codes
  • Structuring error responses
  • Handling query and path parameters
  • Designing consistent API response structures
  • Separating handler logic from business logic
  • Practical Task: Develop a CRUD-based REST API

12. Go Runtime, Compilation, and Project Builds

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

13. File Operations and Web Integration

  • Opening and closing file handles
  • Reading file contents
  • Writing data to files
  • Creating directory structures
  • Accessing file metadata
  • Utilizing buffered I/O
  • Working with data streams
  • Reading and writing JSON files
  • Implementing HTTP clients
  • Making outbound HTTP requests
  • Handling errors from HTTP clients
  • Managing timeouts and request cancellation
  • Processing API response data
  • Practical Task: Fetch data from an external API and store it locally

14. Error Handling and Debugging

  • Go's philosophy on error management
  • 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
  • Utilizing panic and recovery mechanisms
  • Appropriate use of panic
  • Debugging frequent Go issues
  • Logging application activities
  • Utilizing Go debugging tools
  • Exercise: Diagnose and resolve intentionally introduced application errors

15. Interfaces and Abstraction

  • Defining interfaces in Go
  • Implicit interface implementation
  • Defining interface types
  • Handling interface values
  • Empty interfaces and the any type
  • Performing type assertions
  • Using type switches
  • Pointer vs. value interface implementations
  • Designing focused, small interfaces
  • Applying dependency inversion principles
  • Leveraging interfaces for testing
  • Reducing coupling between components
  • Practical Task: Integrate interfaces into the sample web application

16. Packages and Project Organization

  • Creating new packages
  • Package naming conventions
  • Distinguishing exported vs. unexported identifiers
  • Importing external packages
  • Package initialization order
  • Organizing application layers
  • Using internal packages
  • Managing dependencies via Go Modules
  • Adhering to semantic versioning
  • Utilizing third-party libraries
  • Avoiding circular dependencies
  • Designing maintainable Go projects
  • Exercise: Refactor the application into distinct packages

17. Concurrency using Goroutines

  • Concepts of concurrency
  • Introduction to Goroutines
  • Launching new Goroutines
  • Understanding lightweight concurrent execution
  • Addressing synchronization challenges
  • Managing shared state
  • Preventing race conditions
  • Utilizing sync.WaitGroup
  • Implementing Mutexes and Read/Write Mutexes
  • Performing atomic operations
  • Practical Task: Convert a sequential task into concurrent processing

18. Channels

  • Understanding channel mechanics
  • Sending and receiving data through channels
  • Buffered vs. unbuffered channels
  • Blocking behavior of channels
  • Closing channel instances
  • Iterating over channels using range
  • Directional channel types
  • Channel-based communication patterns
  • Using select statements
  • Implementing timeouts and cancellation
  • Worker-pool design patterns
  • Producer/consumer design patterns
  • Practical Task: Build a concurrent worker system

19. Context and Request Management

  • The importance of context in web applications
  • Using context.Context
  • Request-scoped context instances
  • Implementing cancellation logic
  • Setting deadlines
  • Managing timeouts
  • Propagating context through application layers
  • Cancelling database or HTTP operations
  • Avoiding common context misuse patterns
  • Exercise: Integrate request cancellation and timeouts into the web application

20. Testing Go Applications

  • The value of automated testing
  • Writing unit tests
  • Utilizing the testing package
  • Structuring test functions
  • Test naming standards
  • Implementing table-driven tests
  • Testing error scenarios
  • Testing HTTP handlers
  • Using HTTP test servers
  • Managing test fixtures
  • Measuring test coverage
  • Running benchmarks
  • Writing example tests
  • Testing interfaces using mocks or fakes
  • Practical Task: Develop a comprehensive test suite for the sample application

21. Performance Optimization

  • Understanding Go application performance metrics
  • Identifying performance bottlenecks
  • CPU vs. memory performance considerations
  • Selecting efficient data structures
  • Minimizing unnecessary memory allocations
  • Handling strings, bytes, and buffers
  • Managing Goroutine efficiency
  • Avoiding excessive concurrency
  • Implementing caching strategies
  • Considering database and network performance
  • Profiling application behavior
  • 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 inputs
  • Secure handling of HTTP requests
  • Preventing common web vulnerabilities
  • Implementing secure error handling
  • Authentication and authorization concepts
  • Managing secrets and configuration securely
  • Ensuring secure HTTP communication
  • Preventing sensitive data leakage in logs
  • Managing dependency updates
  • Setting resource limits and request timeouts
  • Exercise: Review and harden the security of the sample API

23. Application Logging and Observability

  • Fundamentals of logging
  • Implementing structured logging
  • Defining log levels
  • Logging request details
  • Logging errors effectively
  • Using correlation and request IDs
  • Monitoring application behavior
  • Collecting basic metrics
  • Implementing health-check endpoints
  • Diagnosing production issues
  • Practical Task: Add structured logging and health checks to the application

24. Containerizing the Go Application

  • Benefits of containerization
  • Go applications in a container context
  • Writing effective Dockerfiles
  • Utilizing multi-stage builds
  • Creating minimal runtime images
  • Managing configuration via environment variables
  • Container networking concepts
  • Exposing application ports
  • Running the application inside a container
  • Testing the containerized application
  • Practical Task: Package the sample Go application as a production-ready container

25. Deployment

  • Preparing an application for production environments
  • Building production-grade binaries
  • Managing environment configuration
  • Container-based deployment strategies
  • Designing deployment architecture
  • Configuring reverse proxies
  • Considerations for HTTPS/TLS
  • Implementing application health checks
  • Ensuring graceful shutdown procedures
  • Handling operating system signals
  • Scaling Go web applications
  • Horizontal vs. vertical scaling
  • Basic deployment troubleshooting techniques
  • Practical Task: Deploy the sample web application to a production environment

26. Capstone: Complete Go Web Application

Participants will synthesize the learned concepts by developing a comprehensive application.

The project may encompass:

  • Project initialization using Go Modules
  • Structured package organization
  • HTTP routing implementation
  • REST API endpoint development
  • JSON request and response processing
  • Input validation mechanisms
  • Error handling strategies
  • Interface implementation
  • Concurrent processing workflows
  • Communication with external APIs
  • File or database persistence
  • Automated test suites
  • Structured logging
  • Performance optimization considerations
  • Containerization setup
  • Production configuration management
  • Final deployment steps

27. Review and Best Practices

  • Review of core Go syntax
  • Go coding conventions and standards
  • Writing idiomatic Go code
  • Principles of simplicity in code design
  • Effective package design strategies
  • Best practices for error handling
  • Interface design principles
  • Concurrency best practices
  • Testing strategies and methodologies
  • Performance considerations
  • Maintainability and code readability
  • Common pitfalls for new Go developers
  • Recommended paths for continued Go development

28. Conclusion

  • Summary of key concepts
  • Review of the completed web application
  • Open Q&A and discussion session
  • 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

  • A solid grasp of fundamental programming principles.

Target Audience

  • Software developers.
 28 Hours

Custom Corporate Training

Training solutions designed exclusively for businesses.

  • Customized Content: We adapt the syllabus and practical exercises to the real goals and needs of your project.
  • Flexible Schedule: Dates and times adapted to your team's agenda.
  • Format: Online (live), In-company (at your offices), or Hybrid.
Investment

Price per private group, online live training, starting from 5200 € + VAT*

Contact us for an exact quote and to hear our latest promotions

Testimonials (5)

Provisional Upcoming Courses (Contact Us For More Information)

Related Categories