1//go:build ignore
2
3package main
4
5import (
6 "fmt"
7 "io/ioutil"
8 "log"
9 "os"
10
11 "github.com/99designs/gqlgen/api"
12 "github.com/99designs/gqlgen/codegen/config"
13 "github.com/pkg/errors"
14)
15
16func main() {
17 fmt.Println("Generating graphql code ...")
18
19 log.SetOutput(ioutil.Discard)
20
21 cfg, err := config.LoadConfigFromDefaultLocations()
22 if os.IsNotExist(errors.Cause(err)) {
23 cfg = config.DefaultConfig()
24 } else if err != nil {
25 _, _ = fmt.Fprintln(os.Stderr, err.Error())
26 os.Exit(2)
27 }
28
29 if err = api.Generate(cfg); err != nil {
30 _, _ = fmt.Fprintln(os.Stderr, err.Error())
31 os.Exit(3)
32 }
33}