All Languages
GO
Go
Simple, fast, concurrent
Go (Golang) is a statically typed compiled language designed at Google for building reliable, concurrent, large-scale systems.
Cloud-Native
Microservices
DevOps Tooling
CLI tools
Networking
Time to learn: 1-2 months
1Hello World
beginner
Every Go file belongs to a package; main is the program entry point.
package main
import "fmt"
func main() {
fmt.Println("Hello, ReadmeBuddy!")
}2Structs & Methods
beginner
Attach methods to types using value or pointer receivers.
package main
import "fmt"
type User struct {
Name string
Age int
}
func (u User) Greet() string {
return "Hi, " + u.Name
}
func main() {
u := User{Name: "Ada", Age: 30}
fmt.Println(u.Greet())
}3Goroutines & Channels
intermediate
Concurrent code is a first-class citizen in Go.
package main
import (
"fmt"
"time"
)
func worker(id int, ch chan<- string) {
time.Sleep(time.Second)
ch <- fmt.Sprintf("worker %d done", id)
}
func main() {
ch := make(chan string, 3)
for i := 1; i <= 3; i++ { go worker(i, ch) }
for i := 0; i < 3; i++ { fmt.Println(<-ch) }
}4HTTP Server
intermediate
Build a tiny web server with the standard library.
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello from Go!")
})
http.ListenAndServe(":8080", nil)
}Built something with Go?
Generate a professional README for your project in seconds.