Get in Touch
 Duration 28 hours

Course Outline

1. Introduction to Go

  • Defining Go (Golang).
  • The history and design philosophy behind Go.
  • Go’s role in web and systems programming.
  • Key characteristics:
    • Static typing.
    • Simplicity and readability.
    • Rapid compilation.
    • Native concurrency support.
    • Garbage collection.
    • Cross-platform compilation capabilities.
  • Typical use cases for Go.
  • Benefits and constraints of the language.
  • Comparing Go with C/C++, JavaScript, Ruby, Python, and Java.
  • Understanding the Go ecosystem.
  • An overview of the Go standard library.
  • Go modules and dependency management strategies.
  • The anatomy of a Go application.
  • Hands-on: Analyze and execute a basic Go program.

2. Setting Up the Go Development Environment

  • Installing Go.
  • Understanding the Go toolchain.
  • Configuring necessary environment variables.
  • Selecting an appropriate IDE or code editor.
  • Utilizing the command line for Go tasks.
  • Creating a dedicated Go workspace.
  • Understanding the standard Go project structure.
  • Initializing projects using Go Modules.
  • Using the go mod init command.
  • Managing dependencies via go get.
  • Updating and inspecting dependencies.
  • Formatting source code with gofmt.
  • Running programs using go run.
  • Building applications with go build.
  • Installing Go applications.
  • Cross-compiling applications.
  • Hands-on: Create and configure a Go project within a container.

3. Go Variables, Constants, and Types

  • Declaring variables.
  • Distinguishing between explicit and inferred types.
  • Short variable declarations.
  • Defining constants.
  • Understanding zero values.
  • Variable scope and lifetime.
  • Primitive data types:
    • Integers.
    • Floating-point numbers.
    • Complex numbers.
    • Booleans.
    • Strings.
  • Performing type conversions.
  • Handling Unicode and UTF-8 encoding.
  • Working with runes and bytes.
  • Multiple variable assignment.
  • Comprehending type safety.
  • Exercise: Develop a small command-line data-processing program.

4. Operators and Expressions

  • Arithmetic operators.
  • Comparison operators.
  • Logical operators.
  • Assignment operators.
  • Increment and decrement operations.
  • Operator precedence rules.
  • Executing integer and floating-point calculations.
  • Avoiding 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 dates and times.
  • Calculating durations.
  • Working with Unix timestamps.
  • Handling timeouts.
  • Exercise: Integrate timestamps and duration calculations into an application.

6. Arrays, Slices, Maps, and Structs

Arrays

  • Declaring arrays.
  • Initializing arrays.
  • Iterating over arrays.
  • Working with multidimensional arrays.

Slices

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

Maps

  • Creating maps.
  • Adding and removing entries.
  • Checking for key existence.
  • Iterating over maps.
  • Maps containing complex data structures.

Structs

  • Defining structures.

  • Working with struct fields.

  • Initializing structs.

  • Nested structs.

  • Anonymous structs.

  • Defining struct methods.

  • Using JSON struct tags.

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

7. Conditional Logic and Loops

  • if statements.
  • Using else and else if.
  • Declaring variables within conditions.
  • for loops.
  • Infinite loops.
  • Loop conditions.
  • Using break and continue.
  • Iterating with range.
  • Nested loops.
  • switch statements.
  • Expression-based switches.
  • Handling multiple cases.
  • Default cases.
  • Type switches.
  • Exercise: Implement application validation and processing logic.

8. Functions

  • Defining functions.
  • Managing function parameters.
  • Return values.
  • Multiple return values.
  • Named return values.
  • Variadic functions.
  • Anonymous functions.
  • Function values.
  • Closures.
  • Recursion.
  • Passing functions as arguments.
  • Functions that return errors.
  • Designing small, reusable functions.
  • Exercise: Refactor existing code into reusable functions.

9. Pointers and Memory Concepts

  • Understanding pointers.
  • Address-of and dereference operators.
  • Pointers in function parameters.
  • Pointer receivers.
  • Pointers to structs.
  • Nil pointers.
  • When to utilize pointers.
  • Differences between value and reference semantics.
  • Go’s memory management and garbage collection.
  • Common pointer-related mistakes.
  • Hands-on: Modify application data using pointers.

10. Creating a Web Application in Go

  • Overview of Go’s web capabilities.
  • Introduction to the net/http package.
  • Creating an HTTP server.
  • Handling HTTP requests and responses.
  • HTTP methods.
  • Request URLs and query parameters.
  • HTTP headers.
  • HTTP status codes.
  • Routing fundamentals.
  • Creating handlers.
  • Processing form data.
  • Serving static files.
  • Working with HTML templates.
  • Template variables and control structures.
  • Structuring a web application.
  • Hands-on: Build a basic Go web server.

11. Building a RESTful Web Service

  • REST architecture fundamentals.
  • Designing API endpoints.
  • Using GET, POST, PUT, PATCH, and DELETE methods.
  • Working with JSON.
  • Encoding and decoding JSON.
  • Request validation.
  • Managing HTTP status codes.
  • Handling error responses.
  • 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.
  • Go’s build process.
  • go run.
  • go build.
  • go install.
  • go test.
  • Build flags.
  • Environment-specific configuration.
  • Building for different operating systems and architectures.
  • Generating standalone binaries.
  • Managing application configuration.
  • Exercise: Compile the application for multiple platforms.

13. Working with Files and the Web

  • Opening and closing files.
  • Reading file contents.
  • Writing to files.
  • Creating directories.
  • Accessing file metadata.
  • Buffered I/O operations.
  • Working with streams.
  • Reading and writing JSON files.
  • Using HTTP clients.
  • Making outbound HTTP requests.
  • Handling HTTP client errors.
  • Timeouts and cancellation.
  • Processing API responses.
  • Hands-on: Retrieve data from an external API and persist it locally.

14. Error Handling and Debugging

  • Go’s approach to error management.
  • Returning errors from functions.
  • Checking for errors.
  • Creating custom errors.
  • Wrapping errors.
  • Adding context to errors.
  • Using errors.Is and errors.As.
  • Panic and recovery mechanisms.
  • Appropriate use of panic.
  • Debugging common Go issues.
  • Logging application activity.
  • Utilizing Go debugging tools.
  • Exercise: Diagnose and fix intentionally introduced application errors.

15. Interfaces and Abstraction

  • Defining what an interface is.
  • Implicit interface implementation.
  • Defining interfaces.
  • Interface values.
  • Empty interfaces and any.
  • Type assertions.
  • Type switches.
  • Pointer versus value implementations.
  • Designing small, focused interfaces.
  • Dependency inversion.
  • Using interfaces for testing.
  • Reducing application coupling.
  • Hands-on: Integrate interfaces into the sample web application.

16. Packages and Project Organization

  • Creating packages.
  • Package naming conventions.
  • Exported and unexported identifiers.
  • Importing packages.
  • Package initialization.
  • Organizing application layers.
  • Internal packages.
  • Managing dependencies with Go Modules.
  • Semantic versioning.
  • Utilizing third-party packages.
  • Avoiding circular dependencies.
  • Designing maintainable Go projects.
  • Exercise: Refactor the application into separate packages.

17. Concurrency with Goroutines

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

18. Channels

  • Understanding channels.
  • Sending and receiving values.
  • Buffered versus unbuffered channels.
  • Blocking behavior.
  • Closing channels.
  • Iterating 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

  • The importance of contexts in web applications.
  • context.Context.
  • Request-scoped context.
  • Cancellation mechanisms.
  • Setting deadlines.
  • Managing timeouts.
  • Propagating context through application layers.
  • Cancelling database or HTTP operations.
  • Avoiding common context misuse.
  • Exercise: Add request cancellation and timeouts to the web application.

20. Testing Go Applications

  • The importance of automated testing.
  • Writing unit tests.
  • Using the testing package.
  • Writing test functions.
  • Test naming conventions.
  • Table-driven tests.
  • Testing error scenarios.
  • Testing HTTP handlers.
  • Using 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 application performance.
  • Identifying bottlenecks.
  • CPU versus memory performance.
  • Choosing efficient data structures.
  • Reducing unnecessary allocations.
  • Managing strings, bytes, and buffers.
  • Goroutine management.
  • Avoiding excessive concurrency.
  • Implementing caching strategies.
  • Database and network considerations.
  • Profiling applications.
  • Running benchmarks and performance tests.
  • Using Go’s profiling tools.
  • Exercise: Profile and optimize a deliberately inefficient application.

22. Security and Robust Web Application Practices

  • Validating user input.
  • Safely handling HTTP requests.
  • Preventing common web vulnerabilities.
  • Secure error handling.
  • Authentication and authorization concepts.
  • Managing secrets and configuration.
  • Secure HTTP communication.
  • Avoiding sensitive information in logs.
  • Dependency management and updates.
  • Setting resource limits and request timeouts.
  • Exercise: Review and harden the sample API.

23. Application Logging and Observability

  • Logging fundamentals.
  • Structured logging.
  • Managing log levels.
  • Request logging.
  • Error logging.
  • 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.

24. Containerizing the Go Application

  • The benefits of using containers.
  • Go applications and containerization.
  • Writing a Dockerfile.
  • Using multi-stage builds.
  • Building a minimal runtime image.
  • Managing configuration via environment variables.
  • Container networking.
  • Exposing application ports.
  • Running the application in a container.
  • Testing the containerized application.
  • Hands-on: Package the sample Go application as a production-ready container.

25. Deployment

  • Preparing an application for production.
  • Building production binaries.
  • Configuring the environment.
  • Container-based deployment.
  • Deployment architecture.
  • Reverse proxies.
  • HTTPS/TLS considerations.
  • Application health checks.
  • Implementing graceful shutdown.
  • Handling 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 the learned concepts 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.
  • Maintaining code simplicity.
  • Effective package design.
  • Error-handling best practices.
  • Interface design principles.
  • Concurrency best practices.
  • Testing strategies.
  • Performance considerations.
  • Maintainability and readability.
  • Common mistakes made by new Go developers.
  • Recommended approaches for continuing Go development.

28. Conclusion

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

  • A solid grasp of general programming principles.

Target Audience

  • Software Developers.

Number of participants


Price per participant (excl. VAT)

Testimonials (5)

Upcoming Courses

Related Categories