Go Programming - from Beginner to Professional Learn Everything You Need to Build Modern Software Using Go

Go Programming – From Beginner to Professional is a comprehensive guide that takes your proficiency in the Go programming language from novice to expert. Starting with fundamental concepts, this book covers variables, command-line tools, and working with data before delving into advanced concepts, i...

Descripción completa

Detalles Bibliográficos
Otros Autores: Coyle, Samantha, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham : Packt Publishing [2024]
Edición:Second edition
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009810644806719
Tabla de Contenidos:
  • Cover
  • Title Page
  • Copyright and Credits
  • Contributors
  • Table of Contents
  • Preface
  • Part 1: Scripts
  • Chapter 1: Variables and Operators
  • Technical requirements
  • Introduction to Go
  • What does Go look like?
  • Exercise 1.01 - using variables, packages, and functions to print stars
  • Activity 1.01 - defining and printing
  • Declaring variables
  • Declaring a variable using var
  • Exercise 1.02 - declaring a variable using var
  • Declaring multiple variables at once with var
  • Exercise 1.03 - declaring multiple variables at once with var
  • Skipping the type or value when declaring variables
  • Exercise 1.04 - skipping the type or value when declaring variables
  • Type inference gone wrong
  • Short variable declaration
  • Exercise 1.05 - implementing a short variable declaration
  • Declaring multiple variables with a short variable declaration
  • Exercise 1.06 - declaring multiple variables from a function
  • Using var to declare multiple variables in one line
  • Non-English variable names
  • Changing the value of a variable
  • Exercise 1.07 - changing the value of a variable
  • Changing multiple values at once
  • Exercise 1.08 - changing multiple values at once
  • Operators
  • Exercise 1.09 - using operators with numbers
  • Shorthand operators
  • Exercise 1.10 - implementing shorthand operators
  • Comparing values
  • Exercise 1.11 - comparing values
  • Zero values
  • Exercise 1.12 - zero values
  • Value versus pointer
  • Getting a pointer
  • Exercise 1.13 - getting a pointer
  • Getting a value from a pointer
  • Exercise 1.14 - getting a value from a pointer
  • Function design with pointers
  • Exercise 1.15 - function design with pointers
  • Activity 1.02 - pointer value swap
  • Constants
  • Exercise 1.16 - constants
  • Enums
  • Activity 1.03 - message bug
  • Activity 1.04 - bad count bug
  • Summary.
  • Chapter 2: Command and Control
  • Technical requirements
  • Introduction
  • if statements
  • Exercise 2.01 - a simple if statement
  • if else statements
  • Exercise 2.02 - using an if else statement
  • else if statements
  • Exercise 2.03 - using an else if statement
  • initial if statements
  • Exercise 2.04 - implementing initial if statements
  • Expression switch statements
  • Exercise 2.05 - using a switch statement
  • Exercise 2.06 - switch statements and multiple case values
  • Exercise 2.07 - expressionless switch statements
  • Loops
  • Exercise 2.08 - using a for i loop
  • Exercise 2.09 - looping over arrays and slices
  • range loop
  • Exercise 2.10 - looping over a map
  • Activity 2.01 - looping over map data using range
  • Activity 2.02 - implementing FizzBuzz
  • break and continue
  • Exercise 2.11 - using break and continue to control loops
  • Activity 2.03 - bubble sort
  • goto statements
  • Exercise 2.12 - using goto statements
  • Summary
  • Chapter 3: Core Types
  • Technical requirements
  • Introduction
  • True and false
  • Exercise 3.01 - Program to measure password complexity
  • Numbers
  • Integers
  • Floating-point numbers
  • Exercise 3.02 - Floating-point number accuracy
  • Overflow and wraparound
  • Exercise 3.03 - Triggering number wraparound
  • Big numbers
  • Exercise 3.04 - Big numbers
  • byte
  • Text
  • Rune
  • Exercise 3.05 - Safely looping over a string
  • The nil value
  • Activity 3.01 - Sales tax calculator
  • Activity 3.02 - Loan calculator
  • Summary
  • Chapter 4: Complex Types
  • Technical requirements
  • Introduction
  • Collection types
  • Arrays
  • Exercise 4.01 - Defining an array
  • Comparing arrays
  • Exercise 4.02 - Comparing arrays
  • Initializing arrays using keys
  • Exercise 4.03 - Initializing an array using keys
  • Reading from an array
  • Exercise 4.04 - Reading a single item from an array.
  • Writing to an array
  • Exercise 4.05 - Writing to an array
  • Looping over an array
  • Exercise 4.06 - Looping over an array using a "for i" loop
  • Modifying the contents of an array in a loop
  • Exercise 4.07 - Modifying the contents of an array in a loop
  • Activity 4.01 - Filling an array
  • Slices
  • Exercise 4.08 - Working with slices
  • Appending multiple items to a slice
  • Exercise 4.09 - Appending multiple items to a slice
  • Creating slices from slices and arrays
  • Exercise 4.10 - Creating slices from a slice
  • Understanding slice internals
  • Exercise 4.11 - Using make to control the capacity of a slice
  • Background behavior of slices
  • Exercise 4.12 - Controlling internal slice behavior
  • Map fundamentals
  • Exercise 4.13 - Creating, reading, and writing a map
  • Reading from maps
  • Exercise 4.14 - Reading from a map
  • Activity 4.02 - Printing a user's name based on user input
  • Activity 4.03 - Slicing the week
  • Deleting elements from a map
  • Exercise 4.15 - Deleting an element from a map
  • Activity 4.04 - Removing an element from a slice
  • Simple custom types
  • Exercise 4.16 - Creating a simple custom type
  • Structs
  • Exercise 4.17 - Creating struct types and values
  • Comparing structs to each other
  • Exercise 4.18 - Comparing structs to each other
  • Struct composition using embedding
  • Exercise 4.19 - Struct embedding and initialization
  • Activity 4.05 - Creating a locale checker
  • Type conversions
  • Exercise 4.20 - Numeric type conversions
  • Type assertions and interface{}
  • Exercise 4.21 - Type assertions
  • Type switch
  • Exercise 4.22 - Type switch
  • Activity 4.06 - Type checker
  • Summary
  • Part 2: Components
  • Chapter 5: Functions - Reduce, Reuse, and Recycle
  • Technical requirements
  • Introduction
  • Functions
  • Parts of a function
  • The checkNumbers function.
  • Exercise 5.01 - creating a function to print salesperson expectation ratings from the number of items sold
  • Parameters
  • The difference between an argument and a parameter
  • Exercise 5.02 - mapping index values to column headers
  • Function variable scope
  • Return values
  • Exercise 5.03 - creating a checkNumbers function with return values
  • Activity 5.01 - calculating the working hours of employees
  • Naked returns
  • Exercise 5.04 - mapping a CSV index to a column header with return values
  • Variadic functions
  • Exercise 5.05 - summing numbers
  • Anonymous functions
  • Exercise 5.06 - creating an anonymous function to calculate the square root of a number
  • Closures
  • Exercise 5.07 - creating a closure function to decrement a counter
  • Function types
  • Exercise 5.08 - creating various functions to calculate salary
  • defer
  • Activity 5.02 - calculating the payable amount for employees based on working hours
  • Separating similar code
  • Summary
  • Chapter 6: Don't Panic! Handle Your Errors
  • Technical requirements
  • Introduction
  • What are errors?
  • Syntax errors
  • Runtime errors
  • Exercise 6.01 - runtime errors while adding numbers
  • Semantic errors
  • Exercise 6.02 - a semantic error with walking distance
  • Error handling using other programming languages
  • Error interface type
  • Creating error values
  • Exercise 6.03 - creating an application to calculate pay for the week
  • Panic
  • Exercise 6.04 - Crashing the program on errors using a panic
  • Recover
  • Exercise 6.05 - recovering from a panic
  • Guidelines when working with errors and panics
  • Error wrapping
  • Activity 6.01 - creating a custom error message for a banking application
  • Activity 6.02 - validating a bank customer's direct deposit submission
  • Activity 6.03 - panic on invalid data submission
  • Activity 6.04 - preventing a panic from crashing the app.
  • Summary
  • Chapter 7: Interfaces
  • Technical requirements
  • Introduction
  • Interface
  • Defining an interface
  • Implementing an interface
  • Advantages of implementing interfaces implicitly
  • Exercise 7.01 - implementing an interface
  • Duck typing
  • Polymorphism
  • Empty interface
  • Type assertion and switches
  • Exercise 7.03 - analyzing empty interface{} data
  • Activity 7.01 - calculating pay and performance review
  • any
  • Summary
  • Chapter 8: Generic Algorithm Superpowers
  • Technical requirements
  • Introduction
  • When to use generics?
  • Type parameters
  • Activity 8.01 - a minimum value
  • Type constraints
  • Exercise 8.01 - calculate the maximum value using interfaces
  • Exercise 8.02 - calculate the largest stock of items on a ranch
  • Type inference
  • When to use generics versus interfaces
  • What are some best practices?
  • Summary
  • Part 3: Modules
  • Chapter 9: Using Go Modules to Define a Project
  • Technical requirements
  • Introduction
  • What is a module?
  • Key components when working with Go modules
  • The go.mod file
  • The go.sum file
  • How are modules helpful?
  • Precise and simplified dependency management
  • Versioning and reproducibility
  • Improved collaboration
  • Dependency safety
  • Ease of use while promoting isolation and modularity
  • Exercise 09.01 - creating and using your first module
  • When should you use external modules, and why?
  • Exercise 09.02 - using an external module within our module
  • Consuming multiple modules within a project
  • Activity 9.01 - consuming multiple modules
  • Defining multiple modules within a project
  • Go workspaces
  • Exercise 09.03 - working with workspaces
  • Summary
  • Chapter 10: Packages Keep Projects Manageable
  • Technical requirements
  • Introduction
  • Maintainable
  • Reusable
  • Modular
  • What is a package?
  • Package structure
  • Package naming.
  • Package declarations.