Effective Go Recipes: Fast Solutions to Common Tasks

Tebeka, Miki

  • 出版商: Pragmatic Bookshelf
  • 出版日期: 2024-05-14
  • 售價: $2,150
  • 貴賓價: 9.5$2,043
  • 語言: 英文
  • 頁數: 278
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1680508466
  • ISBN-13: 9781680508468
  • 相關分類: Go 程式語言
  • 海外代購書籍(需單獨結帳)

商品描述

Programmers love Go because it is lightweight, easy to work with, and easy to read. Go gives you the benefits of dynamically typed languages (speed of development) while keeping the upsides of strongly typed languages (security and performance).

Go is a simple language, but programming in Go is about more than just mastering syntax. There's an art to using Go effectively. Squeeze out the full use of advanced networking and multi-core power for which Go was designed. Save precious coding hours with recipes that help you manage objects, collect garbage, and safely use memory. Tackle Unicode, concurrency, and serialization with ease.

All the clean, reusable solutions you need for a wide variety of problems common to Go development. Outfitted with these recipes, your next apps will be more polished and more maintainable than ever.

Start out by tackling time and see how the Go time packager provides types that will do most of the heavy lifting for you. Next, work on recipes tailored to the nuances of processing text, like normalizing strings to avoid bugs. From there, whip up some functions on-the-fly and store functions in variables and data structures.

Ever wondered why Go seems to be peppered with error handling? Working through the next recipes, you'll discover the benefits, which include more robust code. In the section on HTTP, you'll learn tricks like running multiple HTTP servers on the same port and setting timeouts. With concurrency recipes, you'll limit the number of goroutines to improve performance, give your code awareness of timeouts, and decide when to keep your code sequential instead of making it concurrent.

Throughout the book, you'll make Go sizzle following simple recipes and tweaking them to fit your own apps. Using tools like strong typing and concurrency primitives, build a Go codebase that stays maintainable at scale.

What You Need:

You should know the Go language syntax and have some experience in programming. You will need a Go SDK, a Git client, and for some of the chapters, a C compiler.

商品描述(中文翻譯)

程式設計師喜歡 Go 語言,因為它輕量、易於使用和易於閱讀。Go 提供了動態類型語言的優點(開發速度),同時保持了強類型語言的優勢(安全性和性能)。

Go 是一種簡單的語言,但在 Go 中編程不僅僅是掌握語法。使用 Go 有效地編程是一門藝術。充分利用 Go 設計的高級網絡和多核心功能。通過幫助您管理對象、收集垃圾和安全使用內存的技巧,節省寶貴的編碼時間。輕鬆處理 Unicode、並發性和序列化。

這本書提供了各種常見於 Go 開發的問題的乾淨、可重用的解決方案。憑藉這些配方,您的下一個應用程序將比以往更加精緻和易於維護。

首先,從處理時間開始,看看 Go 的時間封裝程式庫提供的類型將為您完成大部分繁重的工作。接下來,處理針對處理文本的細微差別的配方,例如規範化字符串以避免錯誤。然後,即興創建一些函數,並將函數存儲在變量和數據結構中。

曾經想過為什麼 Go 看起來充滿了錯誤處理?通過閱讀下一節的配方,您將發現其中的好處,包括更健壯的代碼。在 HTTP 部分,您將學習一些技巧,例如在同一個端口上運行多個 HTTP 服務器和設置超時。通過並發配方,您將限制 goroutine 的數量以提高性能,使代碼具有超時意識,並決定何時使代碼保持順序而不是並發。

在整本書中,您將使用簡單的配方使 Go 變得更加精彩,並根據自己的應用程序進行微調。使用強類型和並發原語等工具,構建一個在大規模情況下仍然易於維護的 Go 代碼庫。

所需工具:
您應該熟悉 Go 語言語法並具有一些編程經驗。您需要一個 Go SDK、一個 Git 客戶端,以及一些章節需要的 C 編譯器。

最後瀏覽商品 (20)