Code generation toolkit.
Library api is unstable. If you need stable api, you should fork this project or find an alternative one.
Gogen - is golang code generation toolkit.
Toolkit consists of three parts:
- core provides core functions for code generation
- types integration with
go/types
package - utils contains functions, that do not lead directly to code generation, but can help keep code concise
Features:
- Reach code generation api
- Embedded formatting
- Autoimport
Hello world:
import (
"fmt"
. "github.com/CherkashinEvgeny/gogen"
)
func main() {
mainFunc := Func("main", Sign(In(), Out()), Lines(
Call(
SmartQual("fmt", "fmt", "Println"),
Val("Hello world(:"),
),
))
pkg := Pkg("", "test", Imports(), mainFunc)
fmt.Println(Stringify(pkg))
}
Retry is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
- Email:
cherkashin.evgeny.viktorovich@gmail.com
- Telegram:
@evgeny_cherkashin