https://github.com/jhump/gopoet
A Go API for generating .go source files
https://github.com/jhump/gopoet
codegeneration go golang
Last synced: 8 months ago
JSON representation
A Go API for generating .go source files
- Host: GitHub
- URL: https://github.com/jhump/gopoet
- Owner: jhump
- License: apache-2.0
- Created: 2018-05-30T17:18:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-12T15:26:00.000Z (over 3 years ago)
- Last Synced: 2025-05-31T18:34:48.719Z (10 months ago)
- Topics: codegeneration, go, golang
- Language: Go
- Homepage:
- Size: 74.2 KB
- Stars: 24
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Poet
[](https://travis-ci.com/github/jhump/gopoet/branches)
[](https://goreportcard.com/report/github.com/jhump/gopoet)
[](https://godoc.org/github.com/jhump/gopoet)
This library was inspired by [Java Poet](https://github.com/square/javapoet), as a library that provides
a simple language model for generating Go code.
The model it provides is much simpler than the model exposed by `go/ast` and `go/types`, both in its
expressive power and in its usability. It cannot model implementation code, which is handled in the
library with special support for formatting (a la `fmt.Printf`) references to symbols and types. This
support allows it to provide automatic management of import statements: so you just build the model of
the program to generate, and it will emit the program with all of the necessary imports and properly
qualified references in the code.