diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b71139d..86c83e0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,7 +27,3 @@ jobs: - name: Run tests run: | go test -v ./... - - - name: Run example - run: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} go run ./example/cmd/example/main.go benkraft diff --git a/README.md b/README.md index bd918e6..9a858a9 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,9 @@ For a complete working example, see `example/`. ## Tests -None yet -- instead just follow `example/README.md`'s instructions, and ensure that any diffs in that directory are intentional, and that the example still works. +`go test ./...` does some perfunctory tests. (This is run by GitHub Actions.) + +TODO(benkraft): Figure out how to get GitHub Actions to run the example -- it needs a token. ## Major TODOs @@ -64,8 +66,7 @@ Config options: - HTTP calling convention (is there enough variation to matter?) Other: -- figure out and document go generate syntax - error-checking/validation/etc. everywhere -- tests +- more tests - documentation - a name that's more clearly distinct from other libraries out there diff --git a/example/caller.go b/example/caller.go index d84f559..6192a82 100644 --- a/example/caller.go +++ b/example/caller.go @@ -48,6 +48,12 @@ func Main() { } graphqlClient := graphql.NewClient("https://api.github.com/graphql", &httpClient) + viewerResp, err := getViewer(context.Background(), graphqlClient) + if err != nil { + return + } + fmt.Println("you are", *viewerResp.Viewer.MyName) + userResp, err := getUser(context.Background(), graphqlClient, username) if err != nil { return