gen

command module
v0.0.0-...-35dab5e Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 1 Imported by: 0

README

gen

Simple Go app for source code generation

Motivation

Coming from Haskel/Scala, I miss the abstractions that those collections bring. This small app can be used to bring a piece of that developer experience back to Golang.

Effort

Low hanging fruit, high bang-for-buck, quick-win, code generation FTW!

What does it do?

In the package where it is executed, it will write a <type_name>_list.go file that contains well known methods from Scala/Scalaz/Cats without the typeclasses.

Usage

Either of the CLI or as part of go:generate

// generate a list 
gen list -p <package_name> -t <type_name> -m <map_to> -f <fold_to>

// generate an option type
gen option -p <package_name> -t <type_name> -m <map_to> -f <fold_to>

// generate a range type
gen range -p <package_name>

// generate a string type
gen string -p <package_name>

and/or in your code

//go:generate gen list -p package_name -t type_name -f fold_to

Build

Clone the repository and then go build or go get -u github.com/dnvriend/gen if you just want the gen binary on your path.

Type which gen to find out where it is to uninstall it, or rm $(which gen) to remove it.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Generated code; DO NOT EDIT.
Generated code; DO NOT EDIT.
Generated code; DO NOT EDIT.
Generated code; DO NOT EDIT.

Jump to

Keyboard shortcuts

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