https://github.com/octohelm/gengo
https://github.com/octohelm/gengo
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/octohelm/gengo
- Owner: octohelm
- License: mit
- Created: 2021-06-02T05:03:13.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-12-23T08:27:56.000Z (6 months ago)
- Last Synced: 2025-12-24T22:50:56.964Z (6 months ago)
- Language: Go
- Size: 167 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gengo
[](https://pkg.go.dev/github.com/go-courier/gengo)
[](https://codecov.io/gh/go-courier/gengo)
[](https://goreportcard.com/report/github.com/go-courier/gengo)
```go
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
}
```