learngo
❤️ 1000+ Hand-Crafted Go Examples, Exercises, and Quizzes. 🚀 Learn Go by fixing 1000+ tiny programs.
Top Related Projects
The Go programming language
Learn Go with test-driven development
A curated list of awesome Go frameworks, libraries and software
Curated list of Go design patterns, recipes and idioms
A golang ebook intro how to build a web with golang
Training for Golang (go language)
Quick Overview
"learngo" is a comprehensive GitHub repository created by Inanc Gumus to teach the Go programming language. It contains a structured curriculum with hands-on exercises, projects, and explanations, making it an excellent resource for beginners and intermediate Go developers looking to improve their skills.
Pros
- Extensive coverage of Go concepts, from basics to advanced topics
- Well-organized content with clear explanations and examples
- Includes numerous exercises and projects for practical learning
- Regularly updated to keep pace with Go language developments
Cons
- May be overwhelming for absolute beginners due to the large amount of content
- Some advanced topics might require additional resources for deeper understanding
- Progress tracking and self-assessment tools are limited
Code Examples
Here are a few code examples from the repository:
- Hello World program:
package main
import "fmt"
func main() {
fmt.Println("Hello Gopher!")
}
- Using variables:
package main
import "fmt"
func main() {
name := "Gopher"
age := 5
fmt.Printf("%s is %d years old.\n", name, age)
}
- Simple function:
package main
import "fmt"
func greet(name string) string {
return fmt.Sprintf("Hello, %s!", name)
}
func main() {
message := greet("Gopher")
fmt.Println(message)
}
Getting Started
To get started with the "learngo" repository:
-
Clone the repository:
git clone https://github.com/inancgumus/learngo.git
-
Navigate to the cloned directory:
cd learngo
-
Start with the "01-get-started" folder and progress through the numbered sections.
-
Read the README files in each section for instructions and explanations.
-
Complete the exercises and projects as you go through the material.
-
Use
go run
to execute Go files, for example:go run 01-get-started/main.go
Remember to have Go installed on your system before starting. Happy learning!
Competitor Comparisons
The Go programming language
Pros of go
- Official Go programming language repository with comprehensive documentation
- Contains the full Go source code, allowing deep exploration of language internals
- Actively maintained by the Go team with frequent updates and improvements
Cons of go
- Can be overwhelming for beginners due to its extensive codebase
- Lacks structured learning materials specifically designed for newcomers
- May not provide hands-on exercises or tutorials for learning Go concepts
Code comparison
go:
// Package fmt implements formatted I/O.
package fmt
import (
"internal/fmtsort"
"io"
"os"
)
learngo:
// Package main is an example package
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
The go repository contains the actual implementation of Go's standard library, while learngo focuses on providing simple examples and exercises for learning Go.
learngo is specifically designed for beginners, offering a structured approach to learning Go with hands-on examples and exercises. It provides a more accessible entry point for those new to the language.
go, being the official repository, is more suitable for experienced developers looking to understand the language's internals or contribute to its development. It offers a comprehensive view of Go's implementation but may be less approachable for newcomers.
Learn Go with test-driven development
Pros of learn-go-with-tests
- Emphasizes Test-Driven Development (TDD) approach
- Covers advanced topics like concurrency and property-based testing
- Provides practical examples with real-world applications
Cons of learn-go-with-tests
- May be challenging for absolute beginners due to TDD focus
- Less comprehensive coverage of basic Go syntax and concepts
- Fewer exercises and hands-on practice opportunities
Code Comparison
learn-go-with-tests example:
func TestHello(t *testing.T) {
got := Hello("Chris")
want := "Hello, Chris"
if got != want {
t.Errorf("got %q want %q", got, want)
}
}
learngo example:
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
The learn-go-with-tests example demonstrates a test-driven approach, while learngo focuses on basic syntax and concepts. learn-go-with-tests introduces testing from the start, which may be more suitable for experienced programmers or those interested in TDD. learngo provides a gentler introduction to Go, making it more accessible for beginners.
Both repositories offer valuable resources for learning Go, but they cater to different learning styles and experience levels. learn-go-with-tests is ideal for those who want to learn Go while practicing TDD, while learngo is better suited for beginners who want a comprehensive introduction to the language.
A curated list of awesome Go frameworks, libraries and software
Pros of awesome-go
- Comprehensive collection of Go resources, libraries, and tools
- Regularly updated with community contributions
- Covers a wide range of topics and use cases
Cons of awesome-go
- Less structured learning path for beginners
- Lacks hands-on coding exercises and examples
- May be overwhelming for newcomers due to the sheer volume of information
Code comparison
Not applicable, as awesome-go is a curated list of resources rather than a tutorial repository with code examples.
Pros of learngo
- Structured, step-by-step learning path for Go beginners
- Includes hands-on coding exercises and examples
- Focuses on practical, real-world applications
Cons of learngo
- Less comprehensive in terms of overall Go ecosystem coverage
- May not be as suitable for experienced Go developers
- Updates may be less frequent compared to community-driven projects
Code comparison
learngo example:
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
awesome-go doesn't provide code examples directly, as it's a curated list of resources.
Curated list of Go design patterns, recipes and idioms
Pros of go-patterns
- Focuses on design patterns and best practices in Go
- Provides concise, practical examples of common patterns
- Covers a wide range of patterns, including creational, structural, and behavioral
Cons of go-patterns
- Less comprehensive for beginners learning Go from scratch
- Lacks detailed explanations and context for each pattern
- Not structured as a step-by-step learning path
Code Comparison
learngo example (variable declaration):
var speed int
var heat float64
var off bool
var brand string
go-patterns example (singleton pattern):
type singleton struct {}
var instance *singleton
var once sync.Once
func GetInstance() *singleton {
once.Do(func() {
instance = &singleton{}
})
return instance
}
Summary
learngo is more suitable for beginners learning Go from the ground up, offering a structured curriculum with detailed explanations. go-patterns is better for intermediate to advanced developers looking to improve their Go code design and architecture. While learngo covers basic concepts comprehensively, go-patterns focuses on specific design patterns and idiomatic Go practices.
A golang ebook intro how to build a web with golang
Pros of build-web-application-with-golang
- Comprehensive coverage of web application development in Go
- Includes advanced topics like database integration and deployment
- Available in multiple languages, making it accessible to a wider audience
Cons of build-web-application-with-golang
- Less focus on Go language fundamentals
- May be overwhelming for absolute beginners
- Content might be outdated in some sections
Code Comparison
build-web-application-with-golang:
func sayhelloName(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
fmt.Fprintf(w, "Hello %s!", r.Form.Get("name"))
}
learngo:
func main() {
name := "Gopher"
fmt.Printf("Hello %s!\n", name)
}
The code snippets demonstrate the difference in focus between the two repositories. build-web-application-with-golang emphasizes web development concepts, while learngo focuses on teaching Go language basics.
build-web-application-with-golang is better suited for developers who already have some Go experience and want to learn web development specifically. learngo, on the other hand, provides a more structured approach to learning Go from the ground up, making it ideal for beginners or those looking to solidify their understanding of the language fundamentals before diving into web development.
Training for Golang (go language)
Pros of GolangTraining
- More comprehensive coverage of Go topics, including advanced concepts
- Includes practical exercises and examples for hands-on learning
- Regularly updated with new content and improvements
Cons of GolangTraining
- Less structured learning path compared to learngo
- May be overwhelming for absolute beginners due to its breadth
- Lacks interactive coding exercises within the repository
Code Comparison
learngo:
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
GolangTraining:
package main
import "fmt"
func main() {
fmt.Println("Hello, Gophers!")
}
Both repositories provide similar basic examples, but GolangTraining tends to include more advanced code samples throughout its lessons.
Summary
learngo offers a more structured approach for beginners, while GolangTraining provides a comprehensive resource covering a wider range of Go topics. learngo focuses on interactive learning with hands-on exercises, whereas GolangTraining offers a broader collection of examples and explanations. Both repositories are valuable resources for learning Go, with learngo being more suitable for beginners and GolangTraining catering to a wider audience, including intermediate and advanced learners.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Get my book!
Go by Example: Programmer's guide to idiomatic and testable code.
ð https://github.com/inancgumus/gobyexample
This book is what you need once you wrap up the exercises in this repository.
A Huge Number of Go Examples, Exercises and Quizzes
Best way of learning is doing. Inside this repository, you will find thousands of Go examples, exercises and quizzes. I initially created this repository for my Go: Bootcamp Course. Later on, I added a lot of exercises, and I wanted every programmer who is not yet enrolled in the course to learn for free as well. So here it is. Enjoy.
Available in the following languages:
â¤ï¸ Help other fellow developers
Sharing is free but caring is priceless. So, now please click here and share this repository on Twitter.
Stay in touch
-
I usually tweet Go tips and tricks.
-
Get updates from me.
-
Followed by 5K+ developers, and contains dozens of illustrated articles about Go.
License
Whole materials are licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Top Related Projects
The Go programming language
Learn Go with test-driven development
A curated list of awesome Go frameworks, libraries and software
Curated list of Go design patterns, recipes and idioms
A golang ebook intro how to build a web with golang
Training for Golang (go language)
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot