Skip to content

Commit

Permalink
Storing & generating imports
Browse files Browse the repository at this point in the history
  • Loading branch information
hrszpuk committed Sep 13, 2023
1 parent 14b1913 commit e5c7e7a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Generator struct {
func NewGenerator(g *Grabber, name string) *Generator {
gen := new(Generator)
gen.Functions = g.Functions
gen.Variables = g.Variables
gen.Imports = g.Imports
gen.PackageName = name
gen.OutputFileName = name + ".go"
return gen
Expand All @@ -33,8 +33,8 @@ func (g *Generator) Generate() {
g.OutputSource += "\n\n"

// 1. Imports
//g.OutputSource += g.GenerateImports()
//g.OutputSource += "\n\n"
g.OutputSource += g.GenerateImports()
g.OutputSource += "\n\n"

// 2. Load function
g.OutputSource += g.GenerateLoadFunc()
Expand Down Expand Up @@ -63,7 +63,7 @@ func (g *Generator) GenerateImports() string {
output := "import (\n"

for _, imp := range g.Imports {
output += "\t\"" + imp.Path.Value + "\"\n"
output += "\t" + imp.Path.Value + "\n"
}

return output + ")"
Expand Down

0 comments on commit e5c7e7a

Please sign in to comment.