Effortless Golang
I considered writing a book about Go, but decided not to.
Instead I've compiled a list of curated resources to make learning the language as effortless as possible. Hince the name "Effortless Go".
You can Follow me on Twitter @joshduffney.
Learn the Language Fundamentals
- Introducing Go by Caleb Doxsey
- Go in Action by William Kennedy, Brian Ketelsen, and Erik St.Martin
- Learning Go by Jon Bodner
Web Development
- Building Go Web Services and Applications by me
- Let's Go by Alex Edwards
- Let's Go Further by Alex Edwards
Building CLIs
- Master Go CLI and TUI By Ravikanth Chaganti
- Building Modern CLI Applications in Go by Marian Montagnino
Table of Contents
This is the outline from the book proposal I never sent. But if I had to start over learning Go, this is how I'd go about it.
- Before you begin
- Who should read this book.
- Go as your first programming language.
- The Go Playground
- Built-in types
- Data structures
- Staticaly typed vs dynamic
- Primitive types
- Numbers
- Booleans
- Bytes and Runes
- Composite types
- Arrays
- Slices
- Strings
- Maps
- Using fmt to determine the type.
- The Zero Value
- Variables, Constants, and Declarations
- Naming variables
- Defining muliple variables
- Using the short variable delcaration :=
- Variable scopes
- blocks
- Constants
- const vs var
- Type and untyped declarations
- Explicit type conversion
- Control Structures
- What is a control structure?
- The if Statement.
- Avoid else at all costs.
- The switch statements.
- The for Statement
- Range
- Functions
- Declaring and calling functions
- Named and optional parameters
- Variadic input parameters
- Return values.
- Ignoring returned values
- Anonymous functions
- Closures
- Declaring and calling functions
- Pointers
- What are pointers?
- Understanding memory addresses and values
- Why are pointers important?
- Declaring, referencing, and dereferencing pointers.
- Avoiding nil pointers and null pointer dereferences.
- Goโs Type System
- Structs
- User defined types
- Type embedding
- Anonymous structs
- Struct literals
- Methods
- Receivers
- Method sets.
- Interfaces
- Polymorphism
- Structs
- Leaving the playground
- Installing Go
- Go developer survey data results for Go dev environments.
- VS code setup
- Neovim setup
- Using the Go tools
- Go run
- Go build
- Packages, modules, and repositories
- Creating a package
- Go mod
- Flat structure
- Within a directory
- Withing a pkg folder
- Imports and Exports
- Capitals for exports
- Local imports
- 3rd party imports
- Is thatโs a package, whatโs a module?
- Library \ dependency management
- Comment-based documentation
- Creating a package
- The Standard Library
- Navigating pkg.go.dev
- Core packages
- Reading data from files (io/ioutil,)
- Create an http server.
- Sorting with algorithms
- Create a RESTful web service
- Setting up the project structure
- Understanding the net/http package
- Creating a healthcheck endpoint
- Making a user-defined application type with methods
- Adding routes and handlers
- Build a command line app
- Adding a cmd app to the project repo
- Understanding the flags package
- Designing use cases
- The anatomy of a commandline app
- Implementing commands
- Adding flags
- Interacting with APIs
- Writing Tests in Go
- Identifying test cases
- The test package.
- What are the different types of tests?
- Writing unit tests to validate code.
- Testing your API
- Testing your CLI app