Skip to content

octohelm/gengo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gengo

GoDoc Widget codecov Go Report Card

package customgen

import (
	"go/ast"
	"go/types"

	"github.com/octohelm/gengo/pkg/gengo"
)

func init() {
	gengo.Register(&customGen{})
}

type customGen struct {
}

func (*customGen) Name() string {
	return "custom"
}

func (g *customGen) GenerateType(c gengo.Context, named *types.Named) error {
	if !ast.IsExported(named.Obj().Name()) {
		// skip type 
		return gengo.ErrSkip
	}

	if whenSomeThing() {
		// end generate but ignore error
		return gengo.ErrIgnore
	}
	// do generate
	return nil
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published