Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
githubv4
✓ github.com/shurcooL/githubv4
Query the GitHub GraphQL API v4 to get the viewer's login.
package main
import (
"context"
"fmt"
"github.com/shurcooL/githubv4"
"golang.org/x/oauth2"
)
func main() {
src := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: "your_token"},
)
httpClient := oauth2.NewClient(context.Background(), src)
client := githubv4.NewClient(httpClient)
var query struct {
Viewer struct {
Login string
}
}
err := client.Query(context.Background(), &query, nil)
if err != nil {
panic(err)
}
fmt.Println(query.Viewer.Login)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.0.0-20260209031235-2402fdf4a9edlatest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.