HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
In just 24 sessions of one hour or less, Sams Teach Yourself Go in 24 Hours will help new and experienced programmers build software that’s simpler, more reliable, and far more scalable. This book’s straightforward, step-by-step approach guides you from setting up your environment through testing and deploying powerful solutions. Using practical examples, expert Go developer George Ornbo walks you through Go’s fundamental constructs, demonstrates its breakthrough features for concurrent and network programming, and illuminates Go’s powerful new idioms. Every lesson builds on what you’ve already learned, giving you a rock-solid foundation for real-world success.
Step-by-step instructions carefully walk you through the most common Go programming tasks and techniques
Quizzes and exercises help you test your knowledge and stretch your skills
Practical, hands-on examples show you how to apply what you learn
Notes and Tips point out shortcuts, solutions, and problems to avoid
Two bonus chapters available online: Hour 25, “Creating a RESTful JSON API,” and Hour 26 “Creating a TCP Chat Server”
Learn how to...
· Get productive quickly with Go development tools and web servers
· Master core features, including strings, functions, structs, and methods
· Work with types, variables, functions, and control structures
· Make the most of Go’s arrays, slices, and maps
· Write powerful concurrent software with Goroutines and channels
· Handle program errors smoothly
· Promote code reuse with packages
· Master Go’s unique idioms for highly effective coding
· Use regular expressions and time/date functions
· Test and benchmark Go code
· Write basic command-line programs, HTTP servers, and HTTP clients
· Efficiently move Go code into production
· Build basic TCP chat servers and JSON APIs
Register your book at informit.com/register for convenient access to the two bonus chapters online, downloads, updates, and/or corrections as they become available.
Download the code examples for this book from https://github.com/shapeshed/golang-book-examples.
Download the sample pages (includes Hour 18)
Introduction
Hour 1: Getting Started
Introducing Go
Installing Go
Setting Up Your Environment
Writing Your First Go Program: Hello World
Summary
Q&A
Workshop
Exercises
Hour 2: Understanding Types
What Is a Data Type?
Differentiating Between Static and Dynamic Typing
Implementing Booleans
Understanding Numeric Types
Checking the Type of a Variable
Converting Between Types
Summary
Q&A
Workshop
Exercises
Hour 3: Understanding Variables
What Is a Variable?
Declaring Shorthand Variables
Understanding Variables and Zero Values
Writing a Short Variable Declaration
Styles of Variable Declaration
Using Variable Scope
Using Pointers
Declaring Variables with Constants
Summary
Q&A
Workshop
Exercises
Hour 4: Using Functions in Go
What Is a Function?
Defining Variadic Functions
Using Named Return Values
Using Recursive Functions
Passing Functions as Values
Summary
Q&A
Workshop
Exercises
Hour 5: Using Control Flow
Using the if Statement
Using the else Statement
Using the else if Statement
Using Comparison Operators
Using Arithmetic Operators
Using Logical Operators
Using the switch Statement
Looping with the for Statement
Using the defer Statement
Summary
Q&A
Workshop
Exercises
Hour 6: Working with Arrays, Slices, and Maps
Working with Arrays
Working with Slices
Working with Maps
Summary
Q&A
Workshop
Exercises
Hour 7: Using Structs and Pointers
What Is a Struct?
Initializing a Struct
Nesting Structs
Creating Default Values for Structs
Comparing Structs
Understanding Public and Private Values
Differentiating Between Pointer and Value References
Summary
Q&A
Workshop
Exercises
Hour 8: Creating Methods and Interfaces
Using Methods
Creating Method Sets
Working with Methods and Pointers
Using Interfaces
Summary
Q&A
Workshop
Exercises
Hour 9: Working with Strings
Creating String Literals
Understanding Rune Literals
Concatenating Strings
Summary
Q&A
Workshop
Exercises
Hour 10: Handling Errors
Handling Errors and Idiomatic Go
Understanding the Error Type
Creating Errors
Formatting Errors
Returning an Error from a Function
Errors and Usability
Don’t panic
Summary
Q&A
Workshop
Exercises
Hour 11: Working with Goroutines
Understanding Concurrency
Concurrency Versus Parallelism
Understanding Concurrency Through a Web Browser
Blocking and Non-Blocking Code
Handling Concurrent Operations with Goroutines
Using Goroutines to Manage Latency
Defining Goroutines
Summary
Q&A
Workshop
Exercises
Hour 12: Introducing Channels
Using Channels
Using Buffered Channels
Blocking and Flow Control
Using Channels as Function Arguments
Employing the select Statement
Quitting Channels
Summary
Q&A
Workshop
Exercises
Hour 13: Using Packages for Code Reuse
Importing Packages
Understanding Package Usage
Using Third-Party Packages
Installing a Third-Party Package
Managing Third-Party Dependencies
Summary
Q&A
Workshop
Exercises
Hour 14: Naming Conventions in Go
Formatting Code in Go
Using gofmt
Configuring Text Editors
Naming Conventions
Using golint
Using godoc
Automating Workflow
Summary
Q&A
Workshop
Exercises
Hour 15: Testing and Performance
Testing: The Most Important Aspect of Software Development
testing Package
Running Table Tests
Benchmarking in Go
Providing Test Coverage
Summary
Q&A
Workshop
Exercises
Hour 16: Debugging
Logging
Printing Data
Using the fmt Package
Using Delve
Using gdb
Summary
Q&A
Workshop
Exercises
Hour 17: Using Command-Line Programs
Operating with Inputs and Outputs
Accessing Raw Command-Line Arguments
Parsing Command-Line Flags
Working with Types
Customizing Help Text
Creating Subcommands
POSIX Compliance
Installing and Sharing Command-Line Programs
Summary
Q&A
Workshop
Exercises
Hour 18: Creating HTTP Servers
Announcing Your Presence with the “Hello World” Web Server
Examining Requests and Responses
Working with Handler Functions
Handling 404s
Setting a Header
Responding to Different Types of Requests
Receiving Data from GET and POST Requests
Summary
Q&A
Workshop
Exercises
Hour 19: Creating HTTP Clients with Go
Understanding HTTP
Making a GET Request
Making a POST Request
Gaining Further Control over HTTP Requests
Debugging HTTP Requests
Dealing with Timeouts
Summary
Q&A
Workshop
Exercises
Hour 20: Working with JSON
Introducing JSON
Using JSON APIs
Using JSON with Go
Decoding JSON
Mapping Data Types
Working with JSON Received over HTTP
Summary
Q&A
Workshop
Exercises
Hour 21: Working with Files
Importance of Files
Reading and Writing Files with the ioutil Package
Writing to a File
Listing a Directory
Copying a File
Deleting Files
Using Files to Manage Configuration
Summary
Q&A
Workshop
Exercises
Hour 22: Introducing Regular Expressions
Defining Regular Expressions
Getting Familiar with Regular Expression Syntax
Using Regular Expressions for Validation
Using Regular Expressions to Transform Data
Parsing Data with Regular Expressions
Summary
Q&A
Workshop
Exercises
Hour 23: Programming Time in Go
Programming the Element of Time
Putting Your Program to Sleep
Setting a Timeout
Using a Ticker
Representing Time in a String Format
Working with Time Structs
Adding and Subtracting Time
Comparing Different Time Structs
Summary
Q&A
Workshop
Exercises
Hour 24: Deploying Go Code
Understanding Targets
Reducing the Size of Binaries
Using Docker
Downloading Binary Files
Using go get
Releasing Code with Package Managers
Summary
Q&A
Workshop
Exercises
Extra Online Content
Hour 25: Creating a RESTful JSON API
Hour 26: Creating a TCP Chat Server
9780672338038 TOC 11/17/2017