Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shahincsejnu/jennifer-library-hands-on


https://github.com/shahincsejnu/jennifer-library-hands-on

Last synced: about 5 hours ago
JSON representation

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 main

import (
"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 main

import "fmt"

func main() {
fmt.Println("Hello, world")
}
```