github.com/octohelm/storage@v0.0.0-20240516030302-1ac2cc1ea347/internal/cmd/gen/main.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/go-courier/logr/slog"
     7  
     8  	"github.com/go-courier/logr"
     9  
    10  	"github.com/octohelm/gengo/pkg/gengo"
    11  
    12  	_ "github.com/octohelm/gengo/devpkg/runtimedocgen"
    13  	_ "github.com/octohelm/storage/devpkg/enumgen"
    14  	_ "github.com/octohelm/storage/devpkg/tablegen"
    15  )
    16  
    17  func main() {
    18  	c, err := gengo.NewContext(&gengo.GeneratorArgs{
    19  		Entrypoint: []string{
    20  			"github.com/octohelm/storage/testdata/model",
    21  			"github.com/octohelm/storage/internal/testutil",
    22  			"github.com/octohelm/storage/pkg/dal",
    23  		},
    24  		OutputFileBaseName: "zz_generated",
    25  		Globals: map[string][]string{
    26  			"gengo:runtimedoc": {},
    27  		},
    28  	})
    29  	if err != nil {
    30  		panic(err)
    31  	}
    32  
    33  	ctx := logr.WithLogger(context.Background(), slog.Logger(slog.Default()))
    34  	if err := c.Execute(ctx, gengo.GetRegisteredGenerators()...); err != nil {
    35  		panic(err)
    36  	}
    37  }