Makes README example valid
This commit is contained in:
parent
e8b35c877d
commit
1309adde4e
20
README.mkd
20
README.mkd
|
@ -9,14 +9,22 @@ 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
|
||||||
|
|
||||||
header := "<https://api.github.com/user/58276/repos?page=2>; rel=\"next\"," +
|
import (
|
||||||
"<https://api.github.com/user/58276/repos?page=2>; rel=\"last\""
|
"fmt"
|
||||||
links := linkheader.Parse(header)
|
|
||||||
|
|
||||||
for _, link := range links {
|
"github.com/tomnomnom/linkheader"
|
||||||
fmt.Printf("URL: %s; Rel: %s\n", link.URL, link.Rel)
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
header := "<https://api.github.com/user/58276/repos?page=2>; rel=\"next\"," +
|
||||||
|
"<https://api.github.com/user/58276/repos?page=2>; rel=\"last\""
|
||||||
|
links := linkheader.Parse(header)
|
||||||
|
|
||||||
|
for _, link := range links {
|
||||||
|
fmt.Printf("URL: %s; Rel: %s\n", link.URL, link.Rel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user