
Explore Go from the ground up, building demo projects and a full rest api with authentication, and learn essential and advanced concepts for practical, in-depth mastery.
Go is an open-source programming language from Google, released in 2009, praised for simplicity, clarity, scalability, and strong concurrency, with batteries included for network apps and APIs.
Install the Go compiler to run Go code, as Go is a compiled language. Visit Go.dev to download, or use the web-based sandbox to follow along with two course projects.
Create a project folder, open it in a code editor like VS Code, and install the Go extension and required tools to write and run Go code.
Write and run your first Go program by creating app.go with package main, func main, and import fmt to print Hello World with fmt.Print. Run with go run in terminal.
Explore the core essential Go concepts, dive deeper into advanced features, and build a rest api step by step, applying concepts learned throughout the course.
Meet the course prerequisites and watch videos at your own pace. Practice with demo projects, exercises, and code attachments, ask in Q&A, and join the Discord channel.
Explore Go essentials by examining the key components of every Go program, including values and types, variables and constants, functions, and control structures.
Explore the core building blocks of a Go program, including packages, the main function, and how the fmt package outputs text to standard output using string values.
Organize your Go code with packages, starting from the package clause at the top, and import standard library packages like fmt to export and use the print function across files.
Discover why Go uses the main package as the program entry point, and how Go build produces an executable for production beyond go run, including handling a main module error.
Turn your go project into a module with go mod init and a go.mod file defining the module name. Ensure the main package provides the entry point for the executable.
Go requires a main function named main in a main package to start execution. Only one main function exists per program, and libraries like fmt have no main.
Build an investment calculator in go that uses values, types, and variables to compute the future value from user input: amount, annual return rate, and investment horizon.
Declare and manage variables in Go with the var keyword and camelCase names like investmentAmount, expectedReturnRate, and years, then compute futureValue and address int and float64 type mismatch.
Explore how Go's static typing governs int and float64 values, convert integers to float64 for calculations, and use math.Pow to compute future value over years.
Output the future value with the fmt package and Println, demonstrating type handling and clean newline formatting, and practice go run with multi-line imports.
Learn how to use explicit type annotations in Go to store numbers as float64, avoiding unnecessary type conversions and ensuring correct calculations.
Discover how Go's short variable declaration with := enables concise code through type inference, including multiple variables on one line, while preserving readability.
Explore how to use constants in Go to model inflation and compute a future real value by defining a constant inflation rate, applying math.Pow, and printing the results.
Learn how variables differ from constants, how reassignment works, and how to fetch user input in Go using fmt.Scan and pointers.
Highlight how to improve Go user input by using print for on line prompts, then scan investment amount, years, and expected return rate, with explicit var declarations for static typing.
Build a Go command line profit calculator that asks for revenue, expenses, and tax rate, then outputs earnings before tax, earnings after tax, and their ratio.
Build a Go profit calculator by creating a module and a main package, then read revenue, expenses, and tax rate with fmt.Scan, compute ebt, profit, and ratio, and print results.
Learn how to format strings in Go using the fmt package, including Println and Printf, with placeholders like %v, and how to control output precision and line breaks.
Explore how to format decimals in Go strings using the fmt package's Print F and placeholders like %f and %T, including escaping %% and controlling decimals with .0 or .1f.
Discover how the fmt package's Sprint, Sprintf, and Sprintln generate formatted strings you can store as variables, then print with or without line breaks using fmt.Print and printf-like formatting.
Discover how to build multiline strings in Go by using backtick literals to enclose text and insert actual line breaks, rather than splitting a string with double quotes.
Learn the Go concept of functions, including defining and calling custom functions with parameters. See how built-in fmt functions like Printf illustrate function usage in code.
Explore defining and calling functions in Go, including returning multiple values, creating a calculate future values function, and managing variable and constant scope across a file.
Explore an alternative return value syntax in Go by naming return values in the function signature and using those predeclared variables, then decide between explicit naming or a concise return.
Learn how Go uses if statements and booleans to control flow, comparing values with == and combining conditions with && and ||, then print and update a dummy account balance.
Learn how else if in Go handles multiple options and how to deposit money and update the account balance.
Learn to implement if statements in Go by adding an else if branch for withdrawal, updating withdrawalAmount, and deducting from the balance, with notes on state loss between runs.
learn to use an else block in Go to handle default cases, streamline the logic, and output goodbye when the user selects 4.
Use nested if statements in Go to validate deposit and withdrawal amounts, return to stop execution, and print errors for invalid or exceeding balance amounts.
Learn how go's for loop repeats code with an initializer, a condition, and an increment, keeping the application running and repeating actions like balance checks and deposits.
Explore how Go uses a single for loop to create infinite loops, and learn how break, continue, and return control flow to manage loop execution in the main function.
Learn to replace long if-else chains with a Go switch statement, using cases and a default. Clarify break and return behavior inside a switch.
Write a balance to balance.txt using the os package, convert the float64 to a string, set 0644 permissions, and read it on startup to persist across runs.
Learn to read balance data from a file using ReadFile, a global accountBalanceFile constant, and ParseFloat, then set the startup balance from the file to enable persistence.
Learn go error handling by reading and writing files, returning a second value for errors, checking err != nil, and creating custom errors with the errors package to prevent crashes.
Explore error handling in Go by exiting on failure with an early return or invoking panic to stop execution and reveal debugging details.
Validate input with get user input function in profit calculator app to reject negative or zero values, handle errors in main, exit the application, and store results to a file.
Validate user input in getUserInput, handle errors with the errors package and multiple returns, and store EBT, profit, and ratio to a file using fmt and os.
Explore Go fundamentals including variables, constants, types, value conversions, arithmetic, if statements, loops, switch, and custom functions with parameters and returns, plus file handling and error management.
Explore Go packages by organizing code across multiple files and packages, import and use custom packages, and deepen your Go foundation with practical package structure.
Split code across multiple files within the same main package to improve readability, moving a function like presentOptions to a new communication.go file and linking via the Go compiler.
Learn why splitting code into multiple packages enables reusing utility code across projects, with get balance from file and write balance to file functions outsourced for clearer separation.
Transform the code into generic float read/write utilities by renaming getBalanceFromFile to getFloatFromFile, accepting fileName and a default value 1000, handling generic errors, and moving into a package for reuse.
Split code across a new fileops package by moving file operation functions from bank.go into a dedicated folder, ensuring proper package separation and adjusting imports to access functions again.
Import your own go packages with the full module path, such as example.com/bank, then use a package like fmt and the get float from file function, while solving undefined errors.
Discover how Go exports identifiers by capitalizing names to enable cross-package access, renaming to GetFloatFromFile and WriteFloatToFile, and importing from custom packages.
Explore using third-party packages in go by discovering libraries on the discovery page, installing them with go get, updating go.mod, and importing them to generate dummy data like phone numbers.
Learn to create and organize packages across files and across packages, import them into the main package, and use third party packages. Understand that only uppercase items are exposed.
Discover pointers in Go, learn what pointers are and why this feature exists, identify the problems they solve, and learn how to work with pointers in Go.
Explore what pointers are in Go, how the ampersand retrieves addresses, and how pointers avoid value copies while enabling direct mutation of values, with caveats about readability.
Explore pointers in Go by comparing value copies to pointer usage, see how passing variables like age affects memory and function results, and introduce pointer-based code.
Create a pointer named agePointer to hold the address of age with the ampersand. Identify that the pointer type is *int and that it applies to all value types.
Explore pointers as values by printing an address, then dereferencing to access the underlying value, using ampersand to obtain the address and asterisk to dereference.
Learn to pass pointers to functions in Go using pointer parameters and dereferencing with * and &. Recognize that Go forbids pointer arithmetic and that avoiding copies isn’t worth it.
Mutate data in place with a pointer by dereferencing the age pointer, subtracting 18, and writing the result back to memory, potentially without returning a value.
Use pointers to directly edit a value from inside a function by passing a pointer to scan, which dereferences the address and overwrites the value with user input.
Create, use, and dereference pointers in Go, and learn when to pass them around while avoiding overuse, since pointers are an essential feature you'll use throughout the course.
Explore structs in Go, learn how to create and group related data, and add methods to structs to build richer data types.
Start with a new starting project that includes a go.mod and a structs.go file. Use the getUserData helper to fetch and output first name, last name, and birthdate, introducing structs.
Explore how collecting user data across separate variables leads to complex parameter passing. Learn that structs group related data into a single value to simplify data handling and reduce errors.
Define a custom struct type in Go using the type keyword, declare fields with types like string and time.Time, and create nested struct types for a user data model.
Instantiate a value based on the custom user struct by using curly braces after the struct name and initialize fields like userFirstName, userLastName, and userBirthdate, with now for createdAt.
Master struct literal notation to instantiate with or without values, avoid misassignment from field order, and use empty or omitted fields to produce null values.
Instantiate a user struct and pass it to a function, accessing first name, last name, and birth date via dot notation, keeping the function parameter list lean.
Learn when to pass structs by value or by pointer in Go, use the ampersand to obtain addresses, understand dereferencing and the safe shortcut for struct pointers.
Go's structs can group data and host methods by attaching functions as methods with a receiver. Call the method on a struct instance using dot notation to access its data.
Explore how to define mutation methods on structs in Go using pointer receivers to modify the original data, not copies, and understand when value receivers suffice.
Explore creation and constructor functions for structs in Go, using a newUser pattern to build a user value or pointer and reduce code repetition.
Leverage a constructor function in Go to build a user struct with centralized validation, ensuring first name, last name, and birthdate are valid, returning errors when needed.
Move struct logic into a separate package or file, create a user package with user.go, and import time, fmt, and errors to export and access types like user.User.
Expose a struct and its methods in a Go package by using an exported constructor (NewUser), capitalizing names for public access, and managing internal fields and errors.
Learn how Go struct embedding builds on existing structs to create an admin type that includes user fields and methods, with both named and anonymous embedding options.
Go structs group related fields and functions into a single value, with constructors and pointer receivers enabling creation and mutation, including embedding the user type into admin.
Explore creating custom type aliases in Go, attach methods to them, and understand when to alias built-in types like string or int, including practical examples with fmt.
Build a notes app that stores data in a struct and writes to a JSON file, using command-line input for title and content. Master getUserInput and getNoteData with error handling.
Create an exported Note struct in a separate note package with title, content, and createdAt, and a New constructor that validates input and initializes createdAt with time.Now.
Add a display method to the note with a receiver and avoid exposing fields, using the format package to print the title and content, then call it from main.go.
Master handling long user input in Go by using bufio.NewReader(os.Stdin) and ReadString to read from the command line, then trim trailing newlines with strings.TrimSuffix, handling possible errors.
Add a save to file method on the note struct using os.WriteFile to create a JSON file per note. Sanitize title by replacing spaces with underscores and converting to lowercase.
Learn to marshal data to JSON with encoding/json, handle errors, write JSON bytes to a file with permissions using a Save method in Go.
Fix this practice project by adding a .json extension, exporting struct fields by capitalization so json marshal includes them, and update code to use title, content, and createdat, generating learn_go.json.
Explore how to use struct tags in Go to customize JSON output, mapping fields like title and created_at through metadata that the JSON package reads.
Explore interfaces in Go and learn how to create and use them in Go applications, building on your knowledge of structs.
this lecture shows using interfaces to support a todo struct with a text field, json key text, and display and save methods to todo.json, with a constructor that validates content.
Demonstrates building a small Go app that uses the todo package, collects input via getUserInput, creates and saves todos and notes, handles errors, and explores interface-based improvements for code reuse.
Explore using a Go interface to unify saving across to do and note types, creating a single saver contract with a save method that returns an error.
Explore how interfaces serve as types to enable generic, reusable Go code by using a saver interface and a saveData function that calls data.Save.
Reduce code duplication by introducing an outputtable interface that embeds saver and displayer, enabling unified display and save for notes and todos.
Discover how the empty interface in Go serves as an any value allowed type, letting printSomething accept integers, floats, strings, and more, but use with care due to potential dangers.
Learn how Go's type switch inspects a value's type with dot value and type in parentheses, handling int, float64, and string cases with a default fallback.
Explore extracting type information from values in Go using type switches and the dot syntax, retrieving typed values (int, float64, string) and safely handling any type for practical applications.
Explore interfaces in Go, handling any value like int, float64, or string, and learn about type assertions, type switches, and the move toward generics.
Explore generics in Go by turning a function into a generic add function with a type placeholder, enabling return type inference and more reusable code.
Explore Go's built-in value types beyond structs, including arrays, slices, and maps, and learn when to use each for grouping related data.
Learn how arrays store many values describing the same thing and how they differ from structs, then create a Go prices array with four floats.
Create an array of strings in Go with the var keyword and a fixed length, yielding empty slots until values are set, and access or assign elements by zero-based indices.
Create slices from arrays in Go to extract sublists using the 1:3 notation. See how featuredPrices represents the middle elements and how slices enable working with parts of lists.
Master slicing in Go by using start and end indices, omitting the start, and respecting end-exclusive bounds. Create slices from arrays and from other slices, and avoid negative indices.
See how slices are windows into an array, sharing memory and reflecting edits to data. Use len and cap to measure length and capacity, then reslice to the right.
Explore how Go slices create dynamic arrays that grow with append. Learn how append returns a new slice, how reassignment updates it, and how removal can be done by slicing.
learn to work with arrays and slices in go by creating and printing arrays, selecting elements with two approaches, re-slicing, and modeling goals and products.
Explore creating and manipulating arrays and slices in Go, including fixed-length arrays, dynamic slices with append, reslicing and capacity, and using structs for product lists.
Explore unpacking list values in Go by using append with slices to merge lists and append multiple values, and expand a slice with the ... operator.
Explore maps in Go, learn how key-value pairs replace lists, compare maps to structs, and initialize maps with string keys and values like company names and urls.
Dive into mutating maps in Go by reading values by key, adding new pairs, overwriting existing ones, and deleting keys to manage a dynamic websites map.
Understand how maps let any value be a key and offer flexible labeling for values. By contrast, structs define a fixed data shape you cannot extend with new keys.
Use the make function to preallocate slice capacity in Go, learn that a slice is a window into an array, and optimize appends by sizing length and capacity.
Use the make function to create a map with pre-allocated memory for courseRatings, using string keys and float64 values, and add keys like Go course and React course before printing.
Explore type aliases in Go to create concise custom types like floatMap, attach methods, and simplify long built-in types for a smoother development experience.
Master Go's for loop to iterate over arrays, slices, and maps using range, accessing index or key and value for every item, and perform operations across all elements.
Explore using functions as values, anonymous functions, and recursion, plus other advanced functional features in Go applications.
Go's functions are first-class values; pass them as parameters to transform data like slices using a generic transform function, and define custom function types to simplify complex function signatures.
Explore how functions can return other functions and become transformer functions that produce double or triple results, using pointers to slices and conditional logic.
Explore anonymous functions in Go by defining a function on the fly and passing it to a transform numbers call, avoiding a one-off named function.
Explore closures and anonymous functions in Go by building a createTransformer factory that returns functions. Learn how closures capture outer scope variables like factor and ensure consistent behavior across calls.
Explore recursion in Go by implementing factorial with a self-calling function, establish a base case for zero, and compare with a loop-based solution to reveal execution flow.
Master variadic functions in Go by building a sumup that accepts any number of ints using the ... syntax, which collects values into a slice and pairs with fixed parameters.
Explore variadic functions in Go by converting a slice into a list of standalone parameters with the three dots, enabling flexible calls with an optional starting value.
Practice what you learned by building a Go demo that computes tax-inclusive prices from pre-tax inputs using interfaces, structs, and functions across multiple packages.
Develop a basic Go program that multiplies prices by tax rates using slices and a map[float64][]float64, then prints tax included prices for each rate.
Outsource core price calculation to a prices package, define a TaxIncludedPriceJob struct with tax rate, input prices, and a tax-included prices map, and add a calculator method.
Create a constructor function NewTaxIncludedPriceJob that returns a pointer to TaxIncludedPriceJob, initializes input prices and a tax rate parameter, and prepares an empty tax included prices map.
Add a method to a Go struct to compute tax-included prices, using a receiver, a result map, and Sprintf formatting to map raw prices to taxed values.
Implement a LoadData method that opens prices.txt, reads it line by line with a bufio scanner, appends each line to a prices slice, handles errors, and closes the file.
The lecture explains reading price lines, converting them to float64 with strconv.ParseFloat, and storing them in the InputPrices field via a dedicated prices slice.
Outsource string to float conversion to a new Go package named conversion, implementing StringsToFloats to convert a string slice to a float64 slice with error handling using strconv.
Outsource file access to a dedicated filemanager package by introducing a ReadLines function that reads text lines from a file, parameterized by path, and integrates with prices.go LoadData.
Implement a WriteJSON function that writes data to a json file using os.Create and a json encoder, with per-tax-rate file names for each job.
Introduce a FileManager struct with input and output paths, convert read/write into methods, and inject it as IO manager to the price job for cleaner, reusable file access.
Add struct tags in prices.go to control JSON output, renaming keys to tax_rate, input_prices, and tax_included_prices, and exclude IOManager from JSON with json:"-".
Outsource file management logic into a swappable struct to easily swap input and output mechanisms, using a cmd manager with ReadLines and WriteResult that mirrors a file manager.
Introduce an IO manager interface with read lines and right result methods, relying on Go's implicit implementation to accept command or file managers for flexible tax calculation workflow.
Improve error handling in the Go program by making load data return errors, propagating them through process to main.go, and displaying a clear could not process job message on failure.
Practice core concepts by building a simple program, and learn to write generic, reusable, and flexible code. Keep expanding the project and adding features to reinforce learning and practice.
Explore Go's concurrency advantages by learning how goroutines run tasks in parallel and how channels manage communication. Examine controlling code flow to coordinate concurrent tasks for high performance.
Discover how concurrency works in Go by contrasting sequential function calls with blocking, and learn how goroutines enable concurrent execution for parallel tasks.
Learn go concurrency by turning functions into goroutines with the go keyword, enabling parallel execution of a long task and subsequent work.
Demonstrates how goroutines run non-blocking tasks by dispatching four functions and letting the main function finish. Reveals that the program exits before any console output is produced.
Learn to create and use channels in Go with make and chan to transmit data between goroutines. Send booleans with the arrow operator and wait for data.
Learn to synchronize and wait for all goroutines using channels, including a single done channel, a slice of channels, and ranging over a channel, plus closing the channel.
Apply goroutines and channels to a Go project by adding concurrency to process tasks in parallel, synchronize completion with channels, and simulate slow disk writes with deliberate sleep.
Learn to handle errors in goroutines using channels by passing an error channel into the process method, sending errors, and coordinating multiple error channels with a done channel.
In Go, use the select statement inside a for loop to wait on multiple channels (error and done) and handle whichever channel emits first, allowing early error handling and completion.
Learn how to use Go's defer keyword to automatically call file.Close when a function finishes, preventing resource leaks and simplifying file handling during read and write operations.
Unleash Your Potential - with Go and this course!
Welcome to "Go - The Complete Guide," the definitive online course meticulously designed for both newcomers and professionals eager to excel in the dynamic realm of Go programming.
Why Go?
In an era where efficiency and performance are paramount, Go stands out as a powerhouse. Designed by Google, it combines simplicity, robustness, and speed, making it the go-to language for modern backend development, cloud services, and high-performance applications.
Course Overview
This course is your comprehensive journey through the world of Go. From basic syntax to advanced features, this course covers every aspect needed to master Go.
Here's what you'll learn:
Go Fundamentals: Dive deep into Go syntax, variables, types, and control structures.
Concurrent Programming: Unravel the power of Go's concurrency model with goroutines and channels.
Complex Data Structures: Master arrays, slices, maps, and struct types for efficient data manipulation.
Advanced Features: Explore interfaces, error handling, and package management.
Real-World Applications: Build practical, real-world applications to consolidate your learning.
Optimization Techniques: Learn best practices and optimization techniques for writing efficient Go code.
In this course, you'll learn about all those core Go concepts by building multiple demo projects - including a complete REST API with user authentication & SQL database access!
Who Should Enroll?
This course is tailored for:
Developers looking to add a powerful language to their toolkit.
Backend engineers aspiring to build scalable, high-performance applications.
Professionals seeking a deep, practical understanding of Go.
Why Choose This Course?
Expert Instruction: Learn from an experienced Go developer & bestselling online course instructor.
Flexible Learning: Access the course anytime, anywhere, at your pace.
Demo Projects: Apply your knowledge by building multiple demo projects - e.g., a complete REST API
Certificate of Completion: Earn a certificate to showcase your newfound Go expertise.
Ready to Go?
Embark on your journey to mastering Go. Enroll now and transform your career with the power of Go programming.