-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
36 lines (29 loc) · 793 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
References from https://github.com/phcollignon/Go-Template
v2.0
1. Edit main.go
2. Edit tpl
3. Run
Have fun!
v1.0
1. Download zip archive from github or clone this repository
git clone https://github.com/phcollignon/Go-Template
2. Build the binary
cd Go-Template/src && go build
3. Add Go-Template to your binaries or to your PATH
sudo mv Go-Template /usr/local/bin
or
ln -s /Users/xxx/go/src/Go-Template/src/Go-Template /usr/local/bin/Go-Template
4. Modify the suffix of the output file
.generated.txt -> .go
5. Rebuild
example:
func genController() {
ctl := fmt.Sprintf("Go-Template -d controller.json -t controller.tpl -o %s", controllerPath)
c := cmd.NewCommand(ctl)
err := c.Execute()
if err != nil {
panic(err.Error())
}
fmt.Println(c.Stdout())
fmt.Println(c.Stderr())
}