Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shahincsejnu/jennifer-library-hands-on
https://github.com/shahincsejnu/jennifer-library-hands-on
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/shahincsejnu/jennifer-library-hands-on
- Owner: shahincsejnu
- License: apache-2.0
- Created: 2021-03-23T05:06:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-03-24T19:29:54.000Z (over 3 years ago)
- Last Synced: 2023-03-21T22:56:01.343Z (over 1 year ago)
- Language: Go
- Size: 64.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jennifer-library-hands-on
- Followed [jennifer repo](https://github.com/dave/jennifer)
## Intro
* Jennifer is a code generator for Go
* Example:
- for this code:
```go
package mainimport (
"fmt"
. "github.com/dave/jennifer/jen"
)
func main() {
f := NewFile("main")
f.Func().Id("main").Params().Block(
Qual("fmt", "Println").Call(Lit("Hello, world")),
)
fmt.Printf("%#v", f)
}
```
- Output:
```go
package mainimport "fmt"
func main() {
fmt.Println("Hello, world")
}
```