Gir + templates: Cleanup old imports code
- commit
- db0ebd3e247f9ddb086a8c74d7686d234125dac1
- author
- jwijenbergh · · 2024-01-14 13:57 UTC
- parent
- 68520c3
- signature
- GPG Unverified
1A2298F6C34F96E5The key is unknown
2 files · +1 -14
M internal/gir/pass/pass.go +0 -10
| @@ -305,15 +305,6 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||
| 305 | 305 | ||
| 306 | 306 | pkgName := strings.ToLower(ns.Name) | |
| 307 | 307 | for _, fn := range files { | |
| 308 | - | var includesSlice []string | |
| 309 | - | //includesSlice := make([]string, len(includes[fn])) | |
| 310 | - | //i := 0 | |
| 311 | - | //for k, v := range includes[fn] { | |
| 312 | - | // if v { | |
| 313 | - | // includesSlice[i] = k | |
| 314 | - | // } | |
| 315 | - | // i++ | |
| 316 | - | //} | |
| 317 | 308 | methods := 0 | |
| 318 | 309 | for _, i := range interfaces[fn] { | |
| 319 | 310 | methods += len(i.Methods) | |
| @@ -335,7 +326,6 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||
| 335 | 326 | PkgName: pkgName, | |
| 336 | 327 | PkgEnv: strings.ToUpper(pkgName), | |
| 337 | 328 | NeedsInit: needsInit, | |
| 338 | - | Imports: includesSlice, | |
| 339 | 329 | Aliases: aliases[fn], | |
| 340 | 330 | Callbacks: callbacks[fn], | |
| 341 | 331 | Records: records[fn], | |
| @@ -305,15 +305,6 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||||
| 305 | 305 | ||||
| 306 | pkgName := strings.ToLower(ns.Name) | 306 | pkgName := strings.ToLower(ns.Name) | ||
| 307 | for _, fn := range files { | 307 | for _, fn := range files { | ||
| 308 | - | var includesSlice []string | |||
| 309 | - | //includesSlice := make([]string, len(includes[fn])) | |||
| 310 | - | //i := 0 | |||
| 311 | - | //for k, v := range includes[fn] { | |||
| 312 | - | // if v { | |||
| 313 | - | // includesSlice[i] = k | |||
| 314 | - | // } | |||
| 315 | - | // i++ | |||
| 316 | - | //} | |||
| 317 | methods := 0 | 308 | methods := 0 | ||
| 318 | for _, i := range interfaces[fn] { | 309 | for _, i := range interfaces[fn] { | ||
| 319 | methods += len(i.Methods) | 310 | methods += len(i.Methods) | ||
| @@ -335,7 +326,6 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string | |||||
| 335 | PkgName: pkgName, | 326 | PkgName: pkgName, | ||
| 336 | PkgEnv: strings.ToUpper(pkgName), | 327 | PkgEnv: strings.ToUpper(pkgName), | ||
| 337 | NeedsInit: needsInit, | 328 | NeedsInit: needsInit, | ||
| 338 | - | Imports: includesSlice, | |||
| 339 | Aliases: aliases[fn], | 329 | Aliases: aliases[fn], | ||
| 340 | Callbacks: callbacks[fn], | 330 | Callbacks: callbacks[fn], | ||
| 341 | Records: records[fn], | 331 | Records: records[fn], | ||
M templates/go +1 -4
| @@ -4,15 +4,12 @@ package {{.PkgName}} | |||
| 4 | 4 | {{ $NotGObject := ne .PkgName "gobject" }} | |
| 5 | 5 | {{ $NotGLib := ne .PkgName "glib" }} | |
| 6 | 6 | ||
| 7 | - | {{if or .Imports .NeedsInit}} | |
| 7 | + | {{if .NeedsInit}} | |
| 8 | 8 | import ( | |
| 9 | 9 | {{if .NeedsInit}} | |
| 10 | 10 | "github.com/jwijenbergh/purego" | |
| 11 | 11 | "github.com/jwijenbergh/puregotk/internal/core" | |
| 12 | 12 | {{end}} | |
| 13 | - | {{range .Imports -}} | |
| 14 | - | "github.com/jwijenbergh/puregotk/v4/{{.}}" | |
| 15 | - | {{end}} | |
| 16 | 13 | ) | |
| 17 | 14 | {{end}} | |
| 18 | 15 | ||
| @@ -4,15 +4,12 @@ package {{.PkgName}} | |||||
| 4 | {{ $NotGObject := ne .PkgName "gobject" }} | 4 | {{ $NotGObject := ne .PkgName "gobject" }} | ||
| 5 | {{ $NotGLib := ne .PkgName "glib" }} | 5 | {{ $NotGLib := ne .PkgName "glib" }} | ||
| 6 | 6 | ||||
| 7 | - | {{if or .Imports .NeedsInit}} | 7 | + | {{if .NeedsInit}} |
| 8 | import ( | 8 | import ( | ||
| 9 | {{if .NeedsInit}} | 9 | {{if .NeedsInit}} | ||
| 10 | "github.com/jwijenbergh/purego" | 10 | "github.com/jwijenbergh/purego" | ||
| 11 | "github.com/jwijenbergh/puregotk/internal/core" | 11 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 12 | {{end}} | 12 | {{end}} | ||
| 13 | - | {{range .Imports -}} | |||
| 14 | - | "github.com/jwijenbergh/puregotk/v4/{{.}}" | |||
| 15 | - | {{end}} | |||
| 16 | ) | 13 | ) | ||
| 17 | {{end}} | 14 | {{end}} | ||
| 18 | 15 | ||||