A concise and comprehensive guide to exploring, learning, and using Go.
Go in Action introduces the Go language, guiding you from inquisitive developer to Go guru. The book begins by introducing the unique features and concepts of Go. Then, you'll get hands-on experience writing real-world applications including websites and network servers, as well as techniques to manipulate and convert data at speeds that will make your friends jealous.
foreword
preface
acknowledgments
about this book
author online
about the authors
about the cover illustration
1. Introducing Go
1.1. Solving modern programming challenges with Go
1.1.1. Development Speed
1.1.2. Concurrency
1.1.3. Go’s type system
1.1.4. Memory management
1.2. Hello, Go
1.2.1. Introducing the Go Playground
1.3. Summary
2. Go Quick Start
2.1. Program architecture
2.2. Main package
2.3. Search package
2.3.1. search.go
2.3.2. feed.go
2.3.3. match.go/default.go
2.4. RSS matcher
2.5. Summary
3. Packaging and Tooling
3.1. Packages
3.1.1. Package-naming conventions
3.1.2. Package main
3.2. Imports
3.2.1. Remote imports
3.2.2. Named imports
3.3. Init
3.4. Using Go tools
3.5. Going further with Go developer tools
3.5.1. Go vet
3.5.2. Go format
3.5.3. Go documentation
3.6. Collaborating with other Go developers
3.6.1. Creating repositories for sharing
3.7. Dependency management
3.7.1. Vendoring dependencies
3.7.2. Introducing gb
3.8. Summary
4. Arrays, Slices and Maps
4.1. Array internals and fundamentals
4.1.1. Internals
4.1.2. Declaring and initializing
4.1.3. Working with arrays
4.1.4. Multidimensional arrays
4.1.5. Passing arrays between functions
4.2. Slice internals and fundamentals
4.2.1. Internals
4.2.2. Creating and initializing
4.2.3. Working with slices
4.2.4. Multidimensional slices
4.2.5. Passing slices between functions
4.3. Map internals and fundamentals
4.3.1. Internals
4.3.2. Creating and initializing
4.3.3. Working with maps
4.3.4. Passing maps between functions
4.4. Summary
5. Go’s Type System
5.1. User-defined types
5.2. Methods
5.3. The nature of types
5.3.1. Built-in types
5.3.2. Reference types
5.3.3. Struct types
5.4. Interfaces
5.4.1. Standard library
5.4.2. Implementation
5.4.3. Method sets
5.4.4. Polymorphism
5.5. Type embedding
5.6. Exporting and unexporting identifiers
5.7. Summary
6. Concurrency
6.1. Concurrency versus parallelism
6.2. Goroutines
6.3. Race conditions
6.4. Locking shared resources
6.4.1. Atomic functions
6.4.2. Mutexes
6.5. Channels
6.5.1. Unbuffered channels
6.5.2. Buffered channels
6.6. Summary
7. Concurrency Patterns
7.1. Runner
7.2. Pooling
7.3. Work
7.4. Summary
8. Standard Library
8.1. Documentation and Source Code
8.2. Logging
8.2.1. Log Package
8.2.2. Customized Loggers
8.2.3. Conclusion
8.3. Encoding/Decoding
8.3.1. Decoding JSON
8.3.2. Encoding JSON
8.3.3. Conclusion
8.4. Input and Output
8.4.1. Writer and Reader Interfaces
8.4.2. Working Together
8.4.3. Simple Curl
8.4.4. Conclusion
8.5. Summary
9. Testing and benchmarking
9.1. Unit testing
9.1.1. Basic unit test
9.1.2. Table tests
9.1.3. Mocking calls
9.1.4. Testing endpoints
9.2. Examples
9.3. Benchmarking
9.4. Summary
About the Technology
Application development can be tricky enough even when you aren?t dealing with complex systems programming problems like web-scale concurrency and real-time performance. While it?s possible to solve these common issues with additional tools and frameworks, Go handles them right out of the box, making for a more natural and productive coding experience. Developed at Google, Go powers nimble startups as well as big enterprises?companies that rely on high-performing services in their infrastructure.
About the book
Go in Action is for any intermediate-level developer who has experience with other programming languages and wants a jump-start in learning Go or a more thorough understanding of the language and its internals. This book provides an intensive, comprehensive, and idiomatic view of Go. It focuses on the specification and implementation of the language, including topics like language syntax, Go?s type system, concurrency, channels, and testing.What's inside
- Language specification and implementation
- Go's type system
- Internals of Go's data structures
- Testing and benchmarking
About the reader
This book assumes you?re a working developer proficient with another language like Java, Ruby, Python, C#, or C++.
About the authors
William Kennedy is a seasoned software developer and author of the blog GoingGo.Net. Brian Ketelsen and Erik St. Martin are the organizers of GopherCon and coauthors of the Go-based Skynet framework.