gengo

package module
v0.0.0-...-5b2d016 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: MIT Imports: 0 Imported by: 0

README

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
}

Documentation

Overview

Package gengo provides way to generate go codes easier.

Directories

Path Synopsis
devpkg
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL