Get in Touch
 Duration 28 hours

Course Outline

1. Introduction to Go

  • Defining Go (Golang).
  • Historical context and design philosophy.
  • Go's role in web and systems programming.
  • Core characteristics:
    • Static typing.
    • Simplicity and readability.
    • Rapid compilation.
    • Native concurrency support.
    • Automated garbage collection.
    • Cross-platform compilation capabilities.
  • Typical use cases for Go.
  • Strengths and limitations of the language.
  • Comparative analysis with C/C++, JavaScript, Ruby, Python, and Java.
  • Navigating the Go ecosystem.
  • Overview of the Go standard library.
  • Go modules and dependency management strategies.
  • Analyzing the 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 components.
  • Configuring essential environment variables.
  • Selecting appropriate IDEs or code editors.
  • Interacting with Go via the command line.
  • Establishing a Go workspace.
  • Understanding the standard Go project structure.
  • Initializing projects using Go Modules.
  • Utilizing go mod init.
  • Managing dependencies with go get.
  • Updating and inspecting project dependencies.
  • Formatting source code using gofmt.
  • Executing programs with go run.
  • Compiling applications with go build.
  • Installing Go applications.
  • Cross-compiling for different platforms.
  • Hands-on: Create and configure a Go project within a container.

3. Go Variables, Constants and Types

  • Variable declaration methods.
  • Explicit versus inferred type definitions.
  • Short-form variable declarations.
  • Defining constants.
  • Understanding zero values.
  • Variable scope and lifetime.
  • Primitive data types:
    • Integers.
    • Floating-point numbers.
    • Complex numbers.
    • Booleans.
    • Strings.
  • Type conversion techniques.
  • Handling Unicode and UTF-8 encoding.
  • Working with Runes and bytes.
  • Simultaneous variable assignment.
  • Comprehending type safety mechanisms.
  • Exercise: Develop a lightweight command-line data-processing utility.

4. Operators and Expressions

  • Arithmetic operations.
  • Comparison operators.
  • Logical operators.
  • Assignment operators.
  • Increment and decrement operations.
  • Operator precedence rules.
  • Performing integer and floating-point calculations.
  • Avoiding common type-conversion pitfalls.
  • 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 timeout mechanisms.
  • Exercise: Integrate timestamps and duration calculations into an application.

6. Arrays, Slices, Maps and Structs

Arrays

  • Declaring arrays.
  • Initializing array values.
  • Iterating through arrays.
  • Handling multidimensional arrays.

Slices

  • Distinguishing slices from arrays.
  • Creating new slices.
  • Appending elements to slices.
  • Duplicating slice data.
  • Understanding slice length versus capacity.
  • Sub-slicing operations.
  • Common pitfalls associated with slices.

Maps

  • Instantiating maps.
  • Inserting and deleting entries.
  • Verifying key existence.
  • Iterating over map contents.
  • Storing complex data structures in maps.

Structs

  • Defining structural types.

  • Configuring struct fields.

  • Initializing struct instances.

  • Nesting structs.

  • Working with anonymous structs.

  • Implementing struct methods.

  • Utilizing 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 conditions.
  • Declaring variables within conditional statements.
  • for loops.
  • Implementing infinite loops.
  • Defining loop conditions.
  • Using break and continue.
  • Iterating with range.
  • Nested loop structures.
  • switch statements.
  • Expression-based switching.
  • Handling multiple cases.
  • Default case execution.
  • Type-specific switches.
  • Exercise: Implement application validation and processing logic.

8. Functions

  • Defining function signatures.
  • Managing function parameters.
  • Returning single values.
  • Handling multiple return values.
  • Using named return values.
  • Implementing variadic functions.
  • Working with anonymous functions.
  • Treating functions as values.
  • Closures and their applications.
  • Recursion.
  • Passing functions as arguments.
  • Functions that return errors.
  • Designing modular, reusable functions.
  • Exercise: Refactor existing code into reusable functional units.

9. Pointers and Memory Concepts

  • The concept of pointers.
  • Address-of and dereference operators.
  • Pointers in function parameters.
  • Pointer receivers.
  • Pointers referencing structs.
  • Handling Nil pointers.
  • Determining when to utilize pointers.
  • Value versus reference semantics.
  • Go's memory management and garbage collection models.
  • Common errors involving pointers.
  • Hands-on: Modify application data via 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.
  • Processing HTTP requests and responses.
  • Understanding HTTP methods.
  • Managing request URLs and query parameters.
  • Handling HTTP headers.
  • Interpreting HTTP status codes.
  • Basics of routing.
  • Creating request handlers.
  • Processing form data.
  • Serving static assets.
  • Working with HTML templates.
  • Template variables and control flow.
  • Architecting a web application.
  • Hands-on: Build a foundational Go web server.

11. Building a RESTful Web Service

  • REST architecture principles.
  • Designing API endpoints.
  • Implementing GET, POST, PUT, PATCH, and DELETE.
  • Working with JSON data.
  • Encoding and decoding JSON.
  • Validating incoming requests.
  • Appropriate use of HTTP status codes.
  • Structuring error responses.
  • Managing query and path parameters.
  • Defining API response structures.
  • Separating handlers from core business logic.
  • Hands-on: Build a CRUD-based 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.
  • Applying build flags.
  • Environment-specific configurations.
  • Building for various OS 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 streams.
  • Reading file contents.
  • Writing data to files.
  • Creating directory structures.
  • Accessing file metadata.
  • Buffered Input/Output operations.
  • Streaming data processing.
  • Reading and writing JSON files.
  • Using HTTP clients.
  • Making outbound HTTP requests.
  • Handling client-side errors.
  • Implementing timeouts and cancellation.
  • Processing API responses.
  • Hands-on: Fetch data from an external API and persist it locally.

14. Error Handling and Debugging

  • Go's explicit error-handling philosophy.
  • Returning errors from functions.
  • Checking and validating errors.
  • Creating custom error types.
  • Wrapping errors for context.
  • Adding descriptive context 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 errors.

15. Interfaces and Abstraction

  • The concept of interfaces.
  • Implicit interface implementation.
  • Defining interface contracts.
  • Interface values.
  • Empty interfaces / any type.
  • Type assertions.
  • Type switches.
  • Pointer versus value implementation.
  • Designing small, focused interfaces.
  • Applying dependency inversion.
  • Leveraging interfaces for testing.
  • Reducing application coupling.
  • 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.
  • Organizing application layers.
  • Internal package usage.
  • Dependency management via Go Modules.
  • Semantic versioning standards.
  • Incorporating third-party packages.
  • Preventing circular dependencies.
  • Designing maintainable Go projects.
  • Exercise: Refactor the application into distinct packages.

17. Concurrency with Goroutines

  • The concept of concurrency.
  • Understanding Goroutines.
  • Spawning new goroutines.
  • Lightweight concurrent execution models.
  • Synchronization challenges.
  • Managing shared state.
  • Race conditions.
  • Using sync.WaitGroup.
  • Mutexes and read/write locks.
  • Atomic operations.
  • Hands-on: Convert sequential tasks into concurrent processing.

18. Channels

  • Understanding channel mechanisms.
  • Sending and receiving values.
  • Buffered versus unbuffered channels.
  • Blocking behavior analysis.
  • Closing channels safely.
  • Ranging over channels.
  • Directional channel types.
  • Channel-based communication patterns.
  • Select statements.
  • Timeouts and cancellation via channels.
  • Worker-pool design patterns.
  • Producer/consumer architectures.
  • Hands-on: Build a concurrent worker system.

19. Context and Request Management

  • The importance of context in web apps.
  • The context.Context type.
  • Request-scoped contexts.
  • Implementing cancellation.
  • Setting deadlines.
  • Managing timeouts.
  • Propagating context through application layers.
  • Cancelling database or HTTP operations.
  • Avoiding common context misuses.
  • Exercise: Add request cancellation and timeout handling to the web app.

20. Testing Go Applications

  • The value of automated testing.
  • Writing unit tests.
  • The testing package.
  • Structuring test functions.
  • Test naming conventions.
  • Table-driven testing strategies.
  • Testing error paths.
  • Testing HTTP handlers.
  • Utilizing HTTP test servers.
  • Creating test fixtures.
  • Measuring test coverage.
  • Writing benchmarks.
  • Example-based tests.
  • Mocking and faking for interface testing.
  • Hands-on: Create a comprehensive test suite for the sample app.

21. Performance Optimization

  • Analyzing Go application performance.
  • Identifying performance bottlenecks.
  • CPU versus memory performance trade-offs.
  • Selecting efficient data structures.
  • Minimizing unnecessary allocations.
  • Handling strings, bytes, and buffers.
  • Goroutine lifecycle management.
  • Avoiding excessive concurrency overhead.
  • Implementing caching strategies.
  • Considerations for database and network I/O.
  • Profiling application performance.
  • Running benchmarks and performance tests.
  • Leveraging Go's built-in profiling tools.
  • Exercise: Profile and optimize an intentionally inefficient application.

22. Security and Robust Web Application Practices

  • Validating user inputs.
  • Secure handling of HTTP requests.
  • Preventing common web vulnerabilities.
  • Secure error-handling practices.
  • Authentication and authorization concepts.
  • Managing secrets and configuration securely.
  • Secure HTTP communication protocols.
  • Avoiding sensitive data leakage in logs.
  • Dependency management and security updates.
  • Enforcing resource limits and request timeouts.
  • Exercise: Review and harden the sample API.

23. Application Logging and Observability

  • Fundamentals of logging.
  • Implementing structured logging.
  • Using appropriate log levels.
  • Logging HTTP requests.
  • Logging errors effectively.
  • Using correlation and request IDs.
  • Monitoring application behavior.
  • Collecting basic metrics.
  • Implementing health-check endpoints.
  • Diagnosing production environment issues.
  • Hands-on: Add structured logging and health checks.

24. Containerizing the Go Application

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

25. Deployment

  • Preparing applications for production.
  • Building optimized production binaries.
  • Configuring production environments.
  • Container-based deployment strategies.
  • Designing deployment architecture.
  • Using reverse proxies.
  • HTTPS/TLS implementation considerations.
  • Implementing application health checks.
  • Handling graceful shutdowns.
  • Processing operating-system signals.
  • Scaling Go web applications.
  • Horizontal versus vertical scaling.
  • Basic deployment troubleshooting.
  • Hands-on: Deploy the sample web application.

26. Capstone: Complete Go Web Application

Participants will synthesize learned concepts by developing a complete, functional application.

The project will encompass:

  • Project initialization using Go Modules.
  • Structured package organization.
  • HTTP routing configuration.
  • Designing REST API endpoints.
  • Handling JSON requests and responses.
  • Implementing input validation.
  • Robust error handling.
  • Interface implementation.
  • Concurrent processing mechanisms.
  • External API integration.
  • File or database persistence.
  • Automated test suites.
  • Comprehensive logging.
  • Performance optimization considerations.
  • Containerization setup.
  • Production environment configuration.
  • Final deployment execution.

27. Review and Best Practices

  • Review of core Go syntax.
  • Adhering to Go coding conventions.
  • Writing idiomatic Go code.
  • Maintaining code simplicity.
  • Effective package design principles.
  • Best practices for error handling.
  • Interface design guidelines.
  • Concurrency best practices.
  • Strategic testing approaches.
  • Performance optimization tips.
  • Ensuring maintainability and readability.
  • Common mistakes by new Go developers.
  • Recommended paths for continued Go development.

28. Conclusion

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

Number of participants


Price per participant

Testimonials (5)

Upcoming Courses

Related Categories