GOLANG Básico - AULA 02: Command Line Programs
Join the Penguin Dev Club for early access, exclusive videos, and exclusive mentorship. / @lucas_badico In lesson 2, we will explore fundamental Go concepts such as functions, structs, and error handling, as well as introduce the use of pointers to handle references and optimize operations. Finally, we will consolidate our learning by creating an interactive calculator in the terminal, applying the best practices learned, such as input validation, methods associated with structs, and error returns. This lesson reinforces the logic and organizational foundation necessary for developing more complex Go programs. Timestamps: 0:00 - Introduction and lesson objectives: creating functions, multiple parameters, multiple returns, and error handling in Go. 0:40 - Introduction to the use of structs to organize data and implement methods. 1:19 - Explanation of the lesson challenge: building a calculator step by step. 1:49 - Review of functions in Go and how to reuse code. 3:55 - Origin of the term `func` in Go and its choice by the language creators. 4:37 - Defining functions with multiple parameters and return values, including error handling. 6:12 - Details on null values and defaults in function return values in Go. 8:28 - How to handle multiple return values in functions and the convention of placing errors in the last return value. 12:24 - Use of the underscore (`_`) to ignore returned variables. 13:47 - Explanation of the reuse of the underscore for unused variables. 15:16 - Parameters in Go functions are always passed by copy, never by reference. 18:02 - Changing values in functions using copies and the need for explicit return values. 21:00 - Introduction to pointers in Go and how they work. 22:54 - Difference between values and pointers, use of `&` and `*` to manipulate memory. 27:03 - Practical examples of pointers: how to access and change referenced values. 32:53 - Comparison with "boxes" to explain the concept of pointers. 38:17 - Why Go doesn't allow pointer arithmetic, unlike C. 42:18 - Navigating lists in Go using `for range`. 45:04 - Structures (structs) in Go to model data and associate methods. 51:19 - Associating methods with structs and how to use them. 55:22 - Changing values in structs using pointers. 57:38 - Importance of practice and manual writing in learning. 58:42 - Building a calculator using structs and methods. 1:02:02 - Adding operations like addition, subtraction, and multiplication on the calculator. 1:03:06 - Using `switch case` in Go for operation selection. 1:06:35 - Organizing the code with structs for reading and structs for writing. 1:08:37 - Methods associated with structs for requesting values and operations. 1:14:16 - Refactoring to save operations in the Runner and using constructors. 1:15:14 - Structuring the program with a Runner that encapsulates logic and maintains consistency. 1:16:20 - Using infinite loops to keep programs "alive" and responsive. 1:18:48 - Preparing for the interfaces class and the power of modularity in Go. 1:20:41 - Homework: separating the calculator code into different files and folders. Summary of Topics Covered Functions: How to create functions with multiple parameters and return values. Convention of returning errors as the last value. Pointers: What are pointers and how do they work with variables and functions. Difference between copied parameters and parameters passed by reference. Why Go doesn't allow pointer arithmetic. Structs and Methods: Organizing data using structs. How to associate functions (methods) with structs. Using pointers in methods to modify internal values. Error Handling: Using the error type to signal problems. Creating and handling custom errors with fmt.Errorf and errors.New. Calculator Construction: Integration of functions, structs, and error handling. Using a Runner to manage the input and execution flow, validating data and organizing the logic. Final Objective To develop a terminal calculator that performs the four basic operations, validating inputs, handling errors, and organizing the logic using good Go programming practices.

GOLANG Basics - LESSON 03: Interfaces, pointers, and encapsulation

Desenvolva este sistema e domine os fundamentos do Golang!

GOLANG alone does NOT make you a dev

GOLANG é para Júniors em 2025?

Aula 01 – Introdução ao Rust | Curso Rust do Zero ao Avançado

Trump Preps for 80th Birthday, Threatens to Hit Iran, Knicks Historic Win & Elon Musk Trillionaire!?

I Don't Think I Can Go Back To Windows...

Golang Tutorial for Beginners | Full Go Course

Curso Lógica de Programação 2026 – Aprenda em 3 Horas (De Verdade!)

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains

Python Variables | Python Operators | Python Tutorial For Beginners | Intellipaat

Co-Creator of Haskell: Why Learn Functional Programming, Useless vs Useful Languages | Simon Jones

ДЕНЬ 1569: «ФЛАМИНГО» ПОЛЕТЕЛИ @Kurbanova_LIVE

GOLANG: THE BIGGEST OPPORTUNITY OF 2026 AND NO ONE IS SEEING IT!

TIME FOR PRAYER TO CONSECRATE YOUR DAY 🔥| Apostle Yves CASTANOU

The AI Take Over Has Completely Backfired and I Can't Be Happier

Inside Anthropic, the $965 Billion AI Juggernaut | The Circuit

How to Start Coding | Programming for Beginners | Learn Coding | Intellipaat

