Go from the beginning - A book on Go, contains fundamentals but also recipes

Overview

Go from the beginning

Welcome to Go from the beginning, a free book containing 25+ lessons that will take you from "zero to hero" in the amazing language Go.

Read online

https://softchris.github.io/golang-book/

Read offline/PDF/EPUB

https://leanpub.com/go-from-the-beginning FREE on LeanPub

Donate

Please consider donating to the people of Ukraine.

Table of content

Chapter Title Section What you will learn Lesson
01 Hello world Basics Why use Go and how to write your first program Lesson
02 Using variables Basics How to declare variables with different data types and how to initialize and assign values Lesson
03 Boolean logic with If and Else Basics How to work with boolean variables and create different execution paths with If, Else and Else If Lesson
04 Converting between strings and numbers Basics How to use the strconv library to convert between primitives and strings. Lesson
05 Loop statements Basics How to repeat statements and iterating over list structures and ways to control the loops Lesson
06 User input Basics How to read user input from the console Lesson
07 Functions Basics Reuse your code by creating functions. Learn how to deal with parameters and how to deal with returns and return types Lesson
08 Error handling Basics How manage errors in your code. This will teach both how to produce errors as well as deal with them Lesson
09 Arrays Composite data types Here we will learn about arrays, how to construct them, access items and iterate over them Lesson
10 Structs Composite data types Structs enables us to collect many fields in one grouping, learn how to create and modify structs Lesson
11 Maps Composite data types Maps make it easy to lookup items if you know the key. Maps have the notion of keys and values. Lesson
12 Interfaces Composite data types Learn how you can model your data as interfaces and how to implement them Lesson
13 Create your first project Projects Learn how to create your first project Lesson
14 Consume external packages Projects Learn how to use external packages Lesson
15 Create shared module Projects Create a module you can share with others Lesson
16 Testing Testing Learn to test your code Lesson
17 JSON Web Dev Learn to work with the JSON format Lesson
18 Build a Web App Web Dev Learn how to build a web app capable of serving many different formats Lesson
19 Logs Miscellaneous Use logging for better management of all kinds of messages in your app Lesson
20 Strings Miscellaneous Work with the string library Lesson
21 Regex Miscellaneous Work with regular epressions Lesson
22 Goroutines Miscellaneous Work with goroutines and channels Lesson
23 Database with Sqlite Miscellaneous Work with databases Lesson
24 Read and write to files IO Learn to read from and write to files Lesson
25 Files and directories IO Learn to perform operations on files and directories Lesson

How to use this content

Every chapter consist of a lesson and an exercise. You are encouraged to run the code in the exercise, modify it and understand how it works.

Contributions

Contributions are very welcome. Please raise an issue of you see something or a PR.

I welcome contributions on:

  • Suggestions on topics to cover
  • Correctness issues
  • Spelling
  • Suggestions on better formatting
  • I hope I hear from you. :)
You might also like...
Contains hundreds of samples for learning Go.
Contains hundreds of samples for learning Go.

Get Started introduction installation Basics hello scopes imports simple multiple alias lifecycle comments simple multiline documentation semicolons v

This repo contains my presentation as well as the codebase for 4Developers Conference.
This repo contains my presentation as well as the codebase for 4Developers Conference.

Software is (Still) Eating the world! This repo contains the code as well as presentation of my talk at 4Developers Conference, Poland 2021. Please se

This repository contains Sougata Khan's solutions to the Exercism Golang Track

Exercism Golang Track This repository contains Sougata Khan's solutions to the Exercism Golang Track Exercises Exercism Problem Solution Description H

an online REST renting book platform which you can authenticate, order, reserve a book in your account.
an online REST renting book platform which you can authenticate, order, reserve a book in your account.

BOOK MAN an online REST renting book platform which you can authenticate, order, reserve a book in your account. it's a microservices project with hig

A reference for the Go community that covers the fundamentals of writing clean code and discusses concrete refactoring examples specific to Go.

A reference for the Go community that covers the fundamentals of writing clean code and discusses concrete refactoring examples specific to Go.

Project work for the course DD1327 - Fundamentals of Computer Science

DD1327_Golang_Project - Project work for the course DD1327 - Fundamentals of Computer Science. Hash table package implemented in Go, May 11 2020.

Go-ticket-booking-app - Simple CLI application which books tickets for a Go conference made to learn the fundamentals of Go programming language.

go-ticket-booking-app Simple CLI application which books ticket for a Go conference made to learn the fundamentals of Go programming language. Gorouti

Basic Event Streaming - Fundamentals of Kafka Studies (BESt-FunKS)

Apache Kafka My study repo for Apache Kafka. Based on this tutorial. Contents Overview Key Terms Event Topic Producer Consumer Partition Getting Start

go-test-trace is like go test but it also generates distributed traces.
go-test-trace is like go test but it also generates distributed traces.

go-test-trace go-test-trace is like go test but it also generates distributed traces. Generated traces are exported in OTLP to a OpenTelemetry collect

I like reading news but I also like the terminal. I am leaning and practicing my go.
I like reading news but I also like the terminal. I am leaning and practicing my go.

I made an api and didn't know how to use it. Screenshots The initial screen when you first run the app. The screen after you specify an id. This app u

Schmeckt wie Damals - Old recipes in new Format
Schmeckt wie Damals - Old recipes in new Format

Schmeckt wie Damals Historisches digitales Kochbuch, alte Rezepte in neuem Format Explore the docs » View Demo · Report Bug · Request Feature Inhaltsv

Cook amazing genetic parts using our cookbook. Recipes and synthetic biology tools to take your breath away.

friendzymes-cookbook Friendly tools for a friendly community. A collection of tutorials and genetic tools for synthetic biology. This cookbook is a su

Recipes for observability solutions at AWS

AWS o11y recipes See aws-observability.github.io/aws-o11y-recipes/. Security See CONTRIBUTING for more information. License This library is licensed u

FujiSimuRecipesGen - A Golang program to generate Fujifilm simulations from recipes of such simulations in CSV

FujiSimuRecipesGen - A Golang program to generate Fujifilm simulations from recipes of such simulations in CSV

Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file.

genv Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables

An easy-to-use XChaCha20-encryption wrapper for io.ReadWriteCloser (even lossy UDP) using ECDH key exchange algorithm, ED25519 signatures and Blake3+Poly1305 checksums/message-authentication for Go (golang). Also a multiplexer.

Quick start Prepare keys (on both sides): [ -f ~/.ssh/id_ed25519 ] && [ -f ~/.ssh/id_ed25519.pub ] || ssh-keygen -t ed25519 scp ~/.ssh/id_ed25519.pub

Glow is an easy-to-use distributed computation system written in Go, similar to Hadoop Map Reduce, Spark, Flink, Storm, etc. I am also working on another similar pure Go system, https://github.com/chrislusf/gleam , which is more flexible and more performant.
A safe way to execute functions asynchronously, recovering them in case of panic. It also provides an error stack aiming to facilitate fail causes discovery.

Async Provides a safe way to execute functions asynchronously, recovering them in case of panic. It also provides an error stack aiming to facilitate

Glow is an easy-to-use distributed computation system written in Go, similar to Hadoop Map Reduce, Spark, Flink, Storm, etc. I am also working on another similar pure Go system, https://github.com/chrislusf/gleam , which is more flexible and more performant.
Comments
  • usage of undefined variable in consume external module chapter

    usage of undefined variable in consume external module chapter

    In the chapter consume external module of online version of the book the code example has an error where the variable sum is used without definition

    package main

    import ( "fmt" "github.com/softchris/math" )

    func main() { sum += math.Add(1,2) fmt.Println(sum) }

    the line sum += math.Add(1,2) should be replaced with sum := math.Add(1,2)

    opened by AdityaVarmaUddaraju 1
  • Fix minor typos and/or grammar in chapters 1 through 16

    Fix minor typos and/or grammar in chapters 1 through 16

    Thanks for your book! I figured I'd submit what I have so far, and I can create another PR for another section. Feel free to take some or all of these suggestions. No pressure.

    opened by elijahmanor 0
  • fix: Update JSON Annotations Linter Errors

    fix: Update JSON Annotations Linter Errors

    This pull request adjusts the "Working with JSON" lesson and updates JSON annotations to remove linter errors.

    I understand the white space is considered optional, but when doing this lesson I was getting linter errors which were resolved by removing said optional whitespace. I think making sure the lesson follows the provided linter ideal for best practice purposes, especially as this resource is aimed at Go beginners.

    opened by crespire 0
  • Ch1:Loops section continue statement is missing.

    Ch1:Loops section continue statement is missing.

    First of all great effort for this book.

    In the Chapter1 Loops section under the Controlling the loop with continue and break the continue program missing the continue statement.

    Expected Output: 2,3 Actual Output: nothing

    Need to Fix: Change the break keyword instead put continue.

    Thank you @softchris

    opened by strangeiot 0
Owner
chris
Cloud Developer Advocate at Microsoft
chris
An online book focusing on Go syntax/semantics and runtime related things

Go 101 is a book focusing on Go syntax/semantics and all kinds of runtime related things. It tries to help gophers gain a deep and thorough understanding of Go. This book also collects many details of Go and in Go programming. The book is expected to be helpful for both beginner and experienced Go programmers.

Go101 4.8k Dec 8, 2022
The Little Go Book is a free introduction to Google's Go programming language

The Little Go Book is a free introduction to Google's Go programming language. It's aimed at developers who might not be quite comfortable with the idea of pointers and static typing. It's longer than the other Little books, but hopefully still captures that little feeling.

Dariush Abbasi 13.4k Dec 2, 2022
Lev 1.1k Dec 7, 2021
Coding along the book

Learn Go with Tests Art by Denise Formats Gitbook EPUB or PDF Translations 中文 Português 日本語 한국어 Türkçe Support me I am proud to offer this resource fo

null 0 Oct 30, 2021
📖 A little guide book on Ethereum Development with Go (golang)

?? A little guide book on Ethereum Development with Go (golang)

Miguel Mota 1.5k Dec 8, 2022
Solutions for the exercises available in the book "A Linguagem de Programação Go" by Alan Donovan and Brian Kernighan

Go Exercises This repository contains possible solutions for the exercises available in the book "A Linguagem de Programação Go (in portuguese)" by Al

Paulo Júnior 1 Feb 20, 2022
Book Catalogue, Order RESTful API

Book Catalogue, Order RESTful API try on heroku: https://pacific-island-57943.herokuapp.com Note: '/' endpoint redirect to github repository for docum

Uğur Cibaroğlu 0 Dec 13, 2021
Source code of the 100 Go Mistakes book

100 Go Mistakes and How to Avoid Them Source code of 100 Go Mistakes and How to Avoid Them. Table of Contents Chapter 1 - Introduction Chapter 2 - Cod

Teiva Harsanyi 3.9k Nov 30, 2022
The resource repository of the book "gRPC - Up and Running".

The resource repository of the book "gRPC - Up and Running".

Happy bull 0 Feb 4, 2022
Mastering-go-exercises - Some code examples from Mihalis Tsoukalos book titled Mastering GO

Mastering go exercises This is a training repository. Here are some code example

null 0 Feb 16, 2022