Awesome Go

go-xkcd

CategoryThird-party APIs
SubcategoryThird-party APIs
Stars0

Go client for the xkcd API

About go-xkcd

go-xkcd

HTTP Client for the xkcd API.

wercker status Coverage Status GoDoc

Details on the xkcd API can be found here.

Install

Outside a project using go modules, get the latest version by running:

go get github.com/nishanths/go-xkcd

Inside a project using go modules, use:

go get github.com/nishanths/go-xkcd/v2

Example

The following program prints details about xkcd.com/599:

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/nishanths/go-xkcd/v2"
)

func main() {
    client := xkcd.NewClient()

    comic, err := client.Get(context.Background(), 599)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%s: %s\n", comic.Title, comic.ImageURL) // Apocalypse: http://imgs.xkcd.com/comics/apocalypse.png
}

Test

To run tests:

$ go test -race

Godoc

https://godoc.org/github.com/nishanths/go-xkcd

License

The MIT License. Copyright © Nishanth Shanmugham.

Frequently Asked Questions

What is go-xkcd?

go-xkcd is a Third-party APIs library for the Go programming language. Go client for the xkcd API

How do I install go-xkcd?

Install go-xkcd with the Go module system using `go get nishanths/go-xkcd`. Check the repository for the current installation instructions.

What category does go-xkcd belong to?

go-xkcd is listed under Third-party APIs, specifically Third-party APIs.

← Back to Third-party APIs