Get in Touch

Course Outline

1. Introduction to Go

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

2. Setting Up the Go Development Environment

  • Installation of Go.
  • Understanding the Go toolchain.
  • Configuring necessary environment variables.
  • Selecting an appropriate IDE or code editor.
  • Interacting with Go via the command line.
  • Establishing a Go workspace.
  • Understanding standard Go project structures.
  • Initializing projects with Go Modules.
  • Utilizing go mod init.
  • Managing dependencies using go get.
  • Updating and verifying dependencies.
  • Formatting source code with gofmt.
  • Executing programs via go run.
  • Compiling applications with go build.
  • Installing Go applications.
  • Performing cross-compilation.
  • Hands-on: Create and configure a Go project within a container.

3. Go Variables, Constants and Types

  • Variable declaration methods.
  • Explicit versus inferred type handling.
  • Using short 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.
  • Working with runes and bytes.
  • Multiple variable assignment.
  • Comprehending type safety.
  • Exercise: Develop a small 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 frequent type-conversion errors.
  • Exercise: Implement calculation and validation logic.

5. Dates, Times and Formatting

  • Utilizing the time package.
  • Creating and modifying date objects.
  • Retrieving the current time.
  • Managing time zones and locations.
  • Parsing date and time strings.
  • Formatting date and time outputs.
  • 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.
  • Array initialization.
  • Iterating through arrays.
  • Handling multidimensional arrays.

Slices

  • Differences between slices and arrays.
  • Creating slices.
  • Appending elements to slices.
  • Copying slice data.
  • Slice length and capacity concepts.
  • Slicing existing slices.
  • Avoiding common slice-related pitfalls.

Maps

  • Creating map instances.
  • Adding and removing entries.
  • Verifying key existence.
  • Iterating over map contents.
  • Maps storing complex data types.

Structs

  • Defining structures.

  • Struct field definitions.

  • Initializing structs.

  • Nested struct configurations.

  • Anonymous structs.

  • Implementing 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.
  • else and else if conditions.
  • Variable declarations within conditional blocks.
  • for loop structures.
  • Infinite loop implementation.
  • Defining loop conditions.
  • break and continue controls.
  • Iteration using range.
  • Nested loop structures.
  • switch statements.
  • Expression-based switching.
  • Handling multiple cases.
  • Default case handling.
  • Type switch mechanisms.
  • Exercise: Implement validation and processing logic for applications.

8. Functions

  • Defining functions.
  • Managing function parameters.
  • Single return values.
  • Multiple return values.
  • Named return values.
  • Variadic functions.
  • Anonymous functions.
  • Functions as first-class values.
  • Closure mechanisms.
  • Recursive function implementation.
  • 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

  • Definition of a pointer.
  • Address-of and dereference operators.
  • Pointers in function parameters.
  • Pointer receivers.
  • Pointers to struct instances.
  • 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 using pointer manipulation.

10. Creating a Web Application in Go

  • Overview of Go's web capabilities.
  • Introduction to the net/http package.
  • Setting up an HTTP server.
  • Handling HTTP requests and responses.
  • Supported HTTP methods.
  • Processing request URLs and query parameters.
  • Managing HTTP headers.
  • HTTP status code usage.
  • Fundamentals of routing.
  • Creating request handlers.
  • Processing form data.
  • Serving static assets.
  • 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 principles.
  • Designing API endpoints.
  • Using GET, POST, PUT, PATCH, and DELETE methods.
  • JSON data handling.
  • JSON encoding and decoding.
  • Request validation strategies.
  • Appropriate HTTP status code usage.
  • Structuring error responses.
  • Managing query and path parameters.
  • Designing API response structures.
  • Separating handlers from business logic.
  • Hands-on: Develop 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.
  • Applying build flags.
  • Environment-specific configurations.
  • 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 streams.
  • Reading file contents.
  • Writing to files.
  • Creating directories.
  • Accessing file metadata.
  • Buffered Input/Output operations.
  • Stream processing.
  • Reading and writing JSON files.
  • Implementing HTTP clients.
  • Making outbound HTTP requests.
  • Handling HTTP client errors.
  • Managing timeouts and cancellations.
  • Processing API response data.
  • Hands-on: Fetch data from an external API and save it locally.

14. Error Handling and Debugging

  • Go's error handling philosophy.
  • Returning errors from functions.
  • Checking for error occurrences.
  • Creating custom error types.
  • Error wrapping techniques.
  • Adding context to error messages.
  • Using errors.Is and errors.As.
  • Panic and recovery mechanisms.
  • Appropriate usage of panic.
  • Debugging typical Go issues.
  • Logging application activities.
  • Utilizing Go debugging tools.
  • Exercise: Identify and fix intentionally introduced application errors.

15. Interfaces and Abstraction

  • Concept of interfaces.
  • Implicit interface implementation.
  • Defining interface contracts.
  • Interface values.
  • Empty interfaces / any type.
  • Type assertion techniques.
  • Type switch operations.
  • Pointer versus value implementations.
  • Designing minimal interfaces.
  • Principle of dependency inversion.
  • Using 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 conventions.
  • Exported versus unexported identifiers.
  • Importing external packages.
  • Package initialization processes.
  • Organizing application layers.
  • Internal package structures.
  • Dependency management via Go Modules.
  • Applying semantic versioning.
  • Incorporating third-party packages.
  • Preventing circular dependencies.
  • Designing maintainable Go projects.
  • Exercise: Refactor the application into distinct packages.

17. Concurrency with Goroutines

  • Definition of concurrency.
  • Understanding Goroutines.
  • Spawning goroutines.
  • Lightweight concurrent execution models.
  • Synchronization challenges.
  • Managing shared state.
  • Preventing race conditions.
  • Using sync.WaitGroup.
  • Mutexes and read/write mutexes.
  • Atomic operations.
  • Hands-on: Transform a sequential task into concurrent processing.

18. Channels

  • Understanding channel mechanics.
  • Sending and receiving values.
  • Buffered versus unbuffered channels.
  • Blocking behavior analysis.
  • Channel closure procedures.
  • Range loops over channels.
  • Directional channel types.
  • Channel-based communication patterns.
  • Select statements.
  • Implementing timeouts and cancellations.
  • Worker-pool design patterns.
  • Producer/consumer design patterns.
  • Hands-on: Build a concurrent worker system.

19. Context and Request Management

  • Importance of context in web applications.
  • The context.Context type.
  • Request-scoped context usage.
  • Context cancellation.
  • Setting deadlines.
  • Implementing 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 application.

20. Testing Go Applications

  • Value of automated testing.
  • Writing unit tests.
  • The testing package.
  • Defining test functions.
  • Test naming standards.
  • Table-driven testing approaches.
  • Testing error conditions.
  • Testing HTTP handlers.
  • Using HTTP test servers.
  • Managing test fixtures.
  • Measuring test coverage.
  • Writing benchmarks.
  • Creating example tests.
  • Testing interfaces with mocks or fakes.
  • Hands-on: Develop a comprehensive test suite for the sample application.

21. Performance Optimization

  • Understanding Go application performance.
  • Identifying performance bottlenecks.
  • CPU versus memory performance analysis.
  • Choosing efficient data structures.
  • Minimizing unnecessary memory allocations.
  • Optimizing strings, bytes, and buffers.
  • Goroutine management strategies.
  • Avoiding excessive concurrency.
  • Implementing caching strategies.
  • Database and network performance considerations.
  • Application profiling techniques.
  • Benchmarking and performance testing.
  • Using Go's built-in profiling tools.
  • Exercise: Profile and optimize a deliberately inefficient application.

22. Security and Robust Web Application Practices

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

23. Application Logging and Observability

  • Fundamentals of logging.
  • Implementing structured logging.
  • Utilizing log levels.
  • Logging HTTP requests.
  • Logging errors.
  • Correlating logs 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 to the application.

24. Containerizing the Go Application

  • Benefits of using containers.
  • Go applications and containerization strategies.
  • Writing an effective Dockerfile.
  • Implementing multi-stage builds.
  • Creating minimal runtime images.
  • Managing configuration via environment variables.
  • Container networking fundamentals.
  • 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-grade binaries.
  • Configuring the environment.
  • Container-based deployment strategies.
  • Designing deployment architectures.
  • Utilizing reverse proxies.
  • HTTPS/TLS security considerations.
  • Implementing application health checks.
  • Managing graceful shutdowns.
  • Handling operating-system signals.
  • Scaling Go web applications.
  • Horizontal versus vertical scaling.
  • Basic deployment troubleshooting.
  • Hands-on: Deploy the sample web application to a target environment.

26. Capstone: Complete Go Web Application

Participants will consolidate their knowledge by developing a complete, end-to-end application.

The project may encompass:

  • Project initialization using Go Modules.
  • Structured package organization.
  • HTTP routing implementation.
  • REST API endpoint creation.
  • JSON request and response handling.
  • Robust input validation.
  • Comprehensive error handling.
  • Interface utilization.
  • Concurrent processing implementation.
  • External API communication.
  • File or database persistence strategies.
  • Automated test suite creation.
  • Effective logging implementation.
  • Performance optimization.
  • Containerization preparation.
  • Production configuration management.
  • Final deployment steps.

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.
  • Error-handling best practices.
  • Interface design principles.
  • Concurrency best practices.
  • Strategic testing approaches.
  • Performance considerations.
  • Prioritizing maintainability and readability.
  • Common mistakes made by new Go developers.
  • Recommended pathways for advanced Go development.

28. Conclusion

  • Review of key concepts covered.
  • Analysis of the completed web application.
  • Open 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

  • Familiarity with fundamental programming principles.

Target Audience

  • Software Developers.
 28 Hours

Number of participants


Price per participant

Testimonials (5)

Upcoming Courses

Related Categories