gogen

package
v0.0.0-...-46fb334 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package gogen implements automation for Go code generation using go generate and templates.

usage example:

$ gogen maketests.go

$ go run maketests.go -output benchmarks.go

Index

Constants

This section is empty.

Variables

View Source
var DefaultUserConfig = &UserConfig{
	Name:                 "Michael Treanor",
	Email:                "skeptycal@gmail.com",
	Username:             "skeptycal",
	DefaultLicense:       "MIT",
	DefaultCopyrightYear: 1975,
}

Functions

func ErrTest

func ErrTest(name string, test interface{}, wantErr bool, t *testing.T) (typ string, ok bool)

func GotWant

func GotWant(name, subname string, got, want interface{}, wantErr bool, t *testing.T) (err error)

func NewRepo

func NewRepo(reponame, license string, year int, user *UserConfig) (r *repoConfig, err error)

func TestParallel

func TestParallel(t *testing.T)

func YearRange

func YearRange(y int) string

YearRange returns a string representation of the year range that is formatted as a typical copyright notice range.

examples:

2015-2020   1970-2019   2021

It will contain the given year, a dash, and the current year. If the y parameter is greater than the current year or more than 50 years ago, it is assumed to be an error and the current year is used. An info level log message is generated if the logger is set to show INFO level, but no error is returned.

Types

type Any

type Any interface{}

type Empty

type Empty struct{}

type UserConfig

type UserConfig struct {
	Name                 string `json:"name"`
	Email                string `json:"email,omitempty"`
	Username             string `json:"username,omitempty"`
	DefaultLicense       string `json:"default_license,omitempty"`
	DefaultCopyrightYear int    `json:"default_copyright_year,omitempty"`
}

func NewUser

func NewUser(name, email, username, defaultLicense string, defaultCopyrightYear int) (*UserConfig, error)

func (*UserConfig) String

func (c *UserConfig) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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