cli/pkg/cmd/extension/ext_tmpls/goBinMain.go.txt
Sam Coe dbc2f05124
Update go-gh to v2 (#7299)
* Update go-gh

* Update code for go-gh v2
2023-04-16 15:34:23 +10:00

26 lines
500 B
Text

package main
import (
"fmt"
"github.com/cli/go-gh/v2/pkg/api"
)
func main() {
fmt.Println("hi world, this is the %s extension!")
client, err := api.DefaultRESTClient()
if err != nil {
fmt.Println(err)
return
}
response := struct {Login string}{}
err = client.Get("user", &response)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("running as %%s\n", response.Login)
}
// For more examples of using go-gh, see:
// https://github.com/cli/go-gh/blob/trunk/example_gh_test.go