detached db0ebd3

Gir + templates: Cleanup old imports code

commit
db0ebd3e247f9ddb086a8c74d7686d234125dac1
author
jwijenbergh · · 2024-01-14 13:57 UTC
parent
68520c3
signature
GPG Unverified1A2298F6C34F96E5 The 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
305305
306306 pkgName := strings.ToLower(ns.Name)
307307 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- //}
317308 methods := 0
318309 for _, i := range interfaces[fn] {
319310 methods += len(i.Methods)
@@ -335,7 +326,6 @@ func (p *Pass) writeGo(r types.Repository, gotemp *template.Template, dir string
335326 PkgName: pkgName,
336327 PkgEnv: strings.ToUpper(pkgName),
337328 NeedsInit: needsInit,
338- Imports: includesSlice,
339329 Aliases: aliases[fn],
340330 Callbacks: callbacks[fn],
341331 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 := 0308 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}}
44 {{ $NotGObject := ne .PkgName "gobject" }}
55 {{ $NotGLib := ne .PkgName "glib" }}
66
7-{{if or .Imports .NeedsInit}}
7+{{if .NeedsInit}}
88 import (
99 {{if .NeedsInit}}
1010 "github.com/jwijenbergh/purego"
1111 "github.com/jwijenbergh/puregotk/internal/core"
1212 {{end}}
13- {{range .Imports -}}
14- "github.com/jwijenbergh/puregotk/v4/{{.}}"
15- {{end}}
1613 )
1714 {{end}}
1815
@@ -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

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close