Source

go-play / libcount.go

Full commit
/* Count number of packges in go standard libarary */
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"regexp"
)

func main() {
	url := "http://golang.org/pkg/"
	response, _ := http.Get(url)
	body, _ := ioutil.ReadAll(response.Body)

	r, _ := regexp.Compile("a href=\"[a-z][^>]*>")
	fmt.Println(len(r.FindAll(body, -1)))
}