Beginning Go programming build reliable and efficient applications with Go
Understand and write programs in Go, a multi-paradigm language with built-in features for concurrent programming. This book enables developers to build software that is simple, reliable, and efficient. It'll also help beginners to start programming Go-based applications. Beginning Go Programmin...
Otros Autores: | , |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
New York, New York :
Apress
[2022]
|
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009703304506719 |
Tabla de Contenidos:
- Intro
- Table of Contents
- About the Authors
- About the Technical Reviewer
- Preface
- Chapter 1: Introduction
- Is GoLang Static-Typed or Compiled?
- Compiled Programming Language
- Statically-Typed Language
- Is Go an Object-Oriented Programming Language?
- Features that Make GoLang the Premium Choice for Programming
- Intentionally Excluded Features from GoLang
- Go Programs
- Summary
- Chapter 2: Go Basics
- Ancestors of Go
- Go Syntax
- Installing Go
- Go Playground
- Developing Go Applications Using IDEs
- Getting Started Programming Go Applications
- Let's Print Hello World!
- How to Execute a Go Program
- Keywords
- Variables
- Variable Data Types
- Variable Naming Conventions
- Declaring Variables
- Taking User Input
- Using scanf
- Using Scanln
- Using bufio
- Math Operators and Packages
- The Math Package
- Dates and Times
- Operators Precedence in Go
- Memory Management and Reference Values
- New vs Make
- Incorrect Memory Allocation Example
- Correct Memory Allocation Example
- Memory Deallocation
- Pointers Data Type
- What Is a Pointer?
- Declaring Pointers in Go
- Comparison with Java and C-Style Languages
- Ordered Values in Arrays and Slices
- Arrays in Go
- Declaring Arrays
- Initializing Arrays
- Accessing Array Elements
- Querying the Size of an Array
- Slices in Go
- Defining Slices
- The len( ) and cap( ) Functions
- Nil Slice
- Sub-Slicing in Go
- The append( ) and copy( ) Functions
- Sorting Slices
- Maps
- Defining Maps
- Adding Entries to a Map Object
- Deleting Entries from a Map Object
- Iterating Over Stored Values in a Map Object
- Structs Data Type
- Defining a Structure
- Accessing Members of a Structure
- Passing Structures as Function Arguments
- Pointers to Structures
- Program Flow
- If Statement
- Switch Statement
- For Statement.
- The goto Statement
- Functions
- Defining a Function
- Doing Function Calls in Go
- Return More than One Value from Functions
- Passing Arguments to Functions
- Call by Value Example
- Call by Reference Example
- Methods
- Write/Read Text Files
- Write Text Files
- Read Text Files
- HTTP Package
- JSON
- Summary
- Chapter 3: Go Recipes: Programming Fundamentals and Basics
- Numbers and Slices in Go
- Working with Maps in Go
- Go's Catch of Error Handling
- Defer and Panic Recovery
- Hands-on Challenge
- Solution
- Summary
- Chapter 4: Working with Text
- Go String Formatting and Working with Unicode
- Case-Insensitive Comparisons in Go
- Regular Expressions and Reading Text Files with Go
- Hands-on Challenge
- Solution
- Summary
- Chapter 5: Structs, Methods, and Interfaces
- Go Structs, Methods, and Interfaces
- Structs
- Declaring Structs in Go
- Creating Instances of a Struct Type
- Recipe to See Structs in Action
- Methods
- Declaring Methods in Go
- Recipe to See Methods in Action
- Interfaces
- Declaring Interfaces in Go
- Implementing Interfaces in Go
- Recipe to See Interfaces in Action
- Empty Interface and Working with IOTA in Go
- JSON Encoding/Decoding
- Generics
- Hands-on Challenge
- Solution
- Summary
- Chapter 6: Working with JSON
- JSON Package
- Unmarshalling JSON with GO
- Parsing Complex JSON with Go
- Marshalling JSON with Go
- Handling Missing Values and Zeros in JSON
- Using mapstructure to Handle Arbitrary JSON
- Summary
- Chapter 7: HTTP
- Go and HTTP Calls
- Authentication and Writing an HTTP Server in Go
- REST with gorilla/mux
- Hands-on Challenge
- Solution
- Summary
- Chapter 8: Concurrency
- Understanding Goroutines
- Converting Sequential Code into Concurrent Code
- Using Goroutines with Shared Resources.
- Seeing the Impact of Shared Resources on Goroutines
- Accessing Shared Resources Using Mutual Exclusion
- Modifying Shared Resources Using Atomic Counters
- Synchronizing Goroutines
- sync.WaitGroup and sync.Once
- Timeouts in Go
- Pooling Goroutines
- Hands-On Challenge
- Solution
- Summary
- Chapter 9: Tricks and Handy Tips
- Importing Packages
- Check What Packages Are Being Imported by Your Application
- Use goimports Instead of gofmt
- Code Organization
- To Use or Not to Use: Custom Constructors
- Modularizing and Organizing Code into Packages
- Dependency Package Management
- Compiler Optimizations
- Using Git's SHA to Set the Build ID
- The Case of Elegant Constants, aka IOTA
- Auto Increment
- Custom Types
- Skipping Values
- Expressions
- Tricky Constants
- Summary
- Index.