Автор: Sau Sheong Chang
Издательство: O’Reilly Media, Inc.
Год: 2022-10-25
Страниц: 111
Язык: английский
Формат: epub (true), pdf, mobi
Размер: 10.27 MB
Go is an increasingly popular language for programming everything from web applications to distributed network services. This practical guide provides recipes to help you unravel common problems and perform useful tasks when working with Go. Each recipe includes self-contained code solutions that you can freely use, along with a discussion of how and why they work. Programmers new to Go can quickly ramp up their knowledge while accomplishing useful tasks, and experienced Go developers can save time by cutting and pasting proven code directly into their applications.
As programmers we often treat error handling as tedious work and an after-thought. That’s generally an error by itself. In fact, just like how we should treat testing, error handling should be top of mind and recovering from the error should be part of good software design. In Go, error handling is treated pretty seriously, though a bit unconventionally. Go has the errors package in the standard library that provides many functions to manipulate errors but most of error handling in Go is built into the language or is part of the idiomatic way of programming in Go. In the Chapter 1 we’ll talk about some of the basic ideas in error handling in Go.
Recipes include:
Creating a module
Calling code from another module
Returning and handling an error
Converting strings to numbers (or converting numbers to strings)
Modifying multiple characters in a string
Creating substrings from a string
Capturing string input
And so much more
Скачать Go Cookbook (Fourth Early Release)