### Go: Execute gh commands and interact with GitHub API Source: https://github.com/cli/go-gh/blob/trunk/README.md This Go code demonstrates how to use the go-gh library to interact with the GitHub CLI and the GitHub API. It shows how to shell out to a `gh` command to list issues and how to use the API client to fetch repository tags. It requires the GitHub CLI to be installed and authenticated. ```Go package main import ( "fmt" "log" "github.com/cli/go-gh/v2" "github.com/cli/go-gh/v2/pkg/api" ) func main() { // These examples assume `gh` is installed and has been authenticated. // Shell out to a gh command and read its output. issueList, _, err := gh.Exec("issue", "list", "--repo", "cli/cli", "--limit", "5") if err != nil { log.Fatal(err) } fmt.Println(issueList.String()) // Use an API client to retrieve repository tags. client, err := api.DefaultRESTClient() if err != nil { log.Fatal(err) } response := []struct{ Name string }{} err = client.Get("repos/cli/cli/tags", &response) if err != nil { log.Fatal(err) } fmt.Println(response) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.