Skip to content

Instantly share code, notes, and snippets.

@mrfade
mrfade / crawl.go
Created October 23, 2022 00:11
A Tour of Go Exercise: Web Crawler
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@mrfade
mrfade / tree.go
Created October 22, 2022 23:21
A Tour of Go Exercise: Equivalent Binary Trees
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
@mrfade
mrfade / slices.go
Created October 22, 2022 22:25
A Tour of Go Exercise: Slices
package main
import (
"golang.org/x/tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
xs := make([][]uint8, dy, dy)
for y := 0; y < dy; y++ {
@mrfade
mrfade / rot13Reader.go
Created October 22, 2022 22:22
A Tour of Go Exercise: rot13Reader
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader