-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.go
More file actions
45 lines (35 loc) · 930 Bytes
/
main.go
File metadata and controls
45 lines (35 loc) · 930 Bytes
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
37
38
39
40
41
42
43
44
45
package main
import (
"github.com/JodeZer/lazydog/brownfox"
)
func main() {
// inject.WriteDogHelper("example", "main")
// fset := token.NewFileSet()
// fbytes, err := ioutil.ReadFile("example/example_main.go")
// f, err := parser.ParseFile(fset, "example_main.go", fbytes, 0)
// if err != nil {
// log.Fatal(err) // parse error
// }
// inj := inject.NewInjector()
// for _, d := range f.Decls {
// if fd, ok := d.(*ast.FuncDecl); ok {
// inj.Inject(fd)
// }
// }
// var buf bytes.Buffer
// printer.Fprint(&buf, fset, f)
// fmt.Println(buf.String())
// if err := ioutil.WriteFile("example/example_main.go", buf.Bytes(), os.ModeExclusive); err != nil {
// panic(err)
// }
bf := brownfox.NewBrownFox("example", -1)
// if err := bf.Backup(); err != nil {
// panic(err)
// }
// if err := bf.Inject(); err != nil {
// panic(err)
// }
if err := bf.Restore(); err != nil {
panic(err)
}
}