Makes README example valid

This commit is contained in:
Tom Hudson 2015-12-10 13:53:34 -05:00
parent e8b35c877d
commit 1309adde4e

View File

@ -9,8 +9,15 @@ Docs can be found on [the GoDoc page](https://godoc.org/github.com/TomNomNom/lin
## Basic Example ## Basic Example
```go ```go
import "github.com/tomnomnom/linkheader" package main
import (
"fmt"
"github.com/tomnomnom/linkheader"
)
func main() {
header := "<https://api.github.com/user/58276/repos?page=2>; rel=\"next\"," + header := "<https://api.github.com/user/58276/repos?page=2>; rel=\"next\"," +
"<https://api.github.com/user/58276/repos?page=2>; rel=\"last\"" "<https://api.github.com/user/58276/repos?page=2>; rel=\"last\""
links := linkheader.Parse(header) links := linkheader.Parse(header)
@ -18,6 +25,7 @@ links := linkheader.Parse(header)
for _, link := range links { for _, link := range links {
fmt.Printf("URL: %s; Rel: %s\n", link.URL, link.Rel) fmt.Printf("URL: %s; Rel: %s\n", link.URL, link.Rel)
} }
}
// Output: // Output:
// URL: https://api.github.com/user/58276/repos?page=2; Rel: next // URL: https://api.github.com/user/58276/repos?page=2; Rel: next