From 76922515c79d85efab6df4ce196374345ec47d7e Mon Sep 17 00:00:00 2001 From: Mathew Byrne Date: Mon, 18 Feb 2019 15:42:37 +1100 Subject: [PATCH] Reintroduce main package in root --- ambient.go | 2 +- generate.go => api/generate.go | 2 +- option.go => api/option.go | 2 +- cmd/gen.go | 4 ++-- cmd/init.go | 5 ++--- main.go | 9 +++++++++ 6 files changed, 16 insertions(+), 8 deletions(-) rename generate.go => api/generate.go (99%) rename option.go => api/option.go (96%) create mode 100644 main.go diff --git a/ambient.go b/ambient.go index 3ec2601cc91..350bc75cc6a 100644 --- a/ambient.go +++ b/ambient.go @@ -1,4 +1,4 @@ -package gqlgen +package main import ( // Import and ignore the ambient imports listed below so dependency managers diff --git a/generate.go b/api/generate.go similarity index 99% rename from generate.go rename to api/generate.go index 86c64b7a12b..3dd083f52f6 100644 --- a/generate.go +++ b/api/generate.go @@ -1,4 +1,4 @@ -package gqlgen +package api import ( "syscall" diff --git a/option.go b/api/option.go similarity index 96% rename from option.go rename to api/option.go index 0c173c7264e..f7ba6774bd0 100644 --- a/option.go +++ b/api/option.go @@ -1,4 +1,4 @@ -package gqlgen +package api import ( "github.com/99designs/gqlgen/codegen/config" diff --git a/cmd/gen.go b/cmd/gen.go index 6a077ec97e4..5613ee31ee9 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/99designs/gqlgen" + "github.com/99designs/gqlgen/api" "github.com/99designs/gqlgen/codegen/config" "github.com/pkg/errors" "github.com/urfave/cli" @@ -36,7 +36,7 @@ var genCmd = cli.Command{ } } - if err = gqlgen.Generate(cfg); err != nil { + if err = api.Generate(cfg); err != nil { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(3) } diff --git a/cmd/init.go b/cmd/init.go index 076d7d20a11..664c523b780 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -7,10 +7,9 @@ import ( "os" "strings" + "github.com/99designs/gqlgen/api" "github.com/99designs/gqlgen/plugin/servergen" - "github.com/99designs/gqlgen" - "github.com/99designs/gqlgen/codegen/config" "github.com/pkg/errors" "github.com/urfave/cli" @@ -73,7 +72,7 @@ var initCmd = cli.Command{ } func GenerateGraphServer(cfg *config.Config, serverFilename string) { - err := gqlgen.Generate(cfg, gqlgen.AddPlugin(servergen.New(serverFilename))) + err := api.Generate(cfg, api.AddPlugin(servergen.New(serverFilename))) if err != nil { fmt.Fprintln(os.Stderr, err.Error()) } diff --git a/main.go b/main.go new file mode 100644 index 00000000000..dbc24135388 --- /dev/null +++ b/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "github.com/99designs/gqlgen/cmd" +) + +func main() { + cmd.Execute() +}