detached c5aba1b

fix(cef): sync purego-cef vendor and fix lint issues

- Add LogFile and InitTraceFile fields to purego-cef Settings
- Remove Go 1.22+ redundant loop var copies (copyloopvar)
- Extract file permission constants (mnd)
- Simplify Widget selector (staticcheck)
- Use InEpsilon for float comparison in test (testifylint)
commit
c5aba1b1e6e189cbef3362aa11882cbe6fe2eb53
author
brice · · 2026-03-21 20:13 UTC
committer
brice · · 2026-03-28 04:37 UTC
parent
fcafef6
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +12 -10
M internal/infrastructure/cef/engine_init.go +9 -4
@@ -243,10 +243,15 @@ func findHelperBinary() string {
243243 return ""
244244 }
245245
246+const (
247+ dirPerm = 0o755
248+ filePerm = 0o644
249+)
250+
246251 func prepareCEFLogFile(cfg config.CEFEngineConfig) (string, error) {
247252 if cfg.LogFile != "" {
248253 runtimeLogFile := filepath.Clean(cfg.LogFile)
249- if err := os.MkdirAll(filepath.Dir(runtimeLogFile), 0o755); err != nil {
254+ if err := os.MkdirAll(filepath.Dir(runtimeLogFile), dirPerm); err != nil {
250255 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(runtimeLogFile), err)
251256 }
252257 return runtimeLogFile, nil
@@ -257,7 +262,7 @@ func prepareCEFLogFile(cfg config.CEFEngineConfig) (string, error) {
257262 return "", fmt.Errorf("getwd: %w", cwdErr)
258263 }
259264 runtimeLogFile := filepath.Join(cwd, ".dev", "dumber", "logs", "cef_runtime.log")
260- if err := os.MkdirAll(filepath.Dir(runtimeLogFile), 0o755); err != nil {
265+ if err := os.MkdirAll(filepath.Dir(runtimeLogFile), dirPerm); err != nil {
261266 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(runtimeLogFile), err)
262267 }
263268 return runtimeLogFile, nil
@@ -279,10 +284,10 @@ func prepareCEFInitTraceFile(cfg config.CEFEngineConfig) (string, error) {
279284 runtimeLogFile = filepath.Join(cwd, ".dev", "dumber", "logs", "cef_runtime.log")
280285 }
281286 bootstrapLogFile := strings.TrimSuffix(runtimeLogFile, filepath.Ext(runtimeLogFile)) + ".bootstrap.log"
282- if err := os.MkdirAll(filepath.Dir(bootstrapLogFile), 0o755); err != nil {
287+ if err := os.MkdirAll(filepath.Dir(bootstrapLogFile), dirPerm); err != nil {
283288 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(bootstrapLogFile), err)
284289 }
285- if err := os.WriteFile(bootstrapLogFile, nil, 0o644); err != nil {
290+ if err := os.WriteFile(bootstrapLogFile, nil, filePerm); err != nil {
286291 return "", fmt.Errorf("reset %s: %w", bootstrapLogFile, err)
287292 }
288293 return bootstrapLogFile, nil
@@ -243,10 +243,15 @@ func findHelperBinary() string {
243 return ""243 return ""
244 }244 }
245 245
246+const (
247+ dirPerm = 0o755
248+ filePerm = 0o644
249+)
250+
246 func prepareCEFLogFile(cfg config.CEFEngineConfig) (string, error) {251 func prepareCEFLogFile(cfg config.CEFEngineConfig) (string, error) {
247 if cfg.LogFile != "" {252 if cfg.LogFile != "" {
248 runtimeLogFile := filepath.Clean(cfg.LogFile)253 runtimeLogFile := filepath.Clean(cfg.LogFile)
249- if err := os.MkdirAll(filepath.Dir(runtimeLogFile), 0o755); err != nil {254+ if err := os.MkdirAll(filepath.Dir(runtimeLogFile), dirPerm); err != nil {
250 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(runtimeLogFile), err)255 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(runtimeLogFile), err)
251 }256 }
252 return runtimeLogFile, nil257 return runtimeLogFile, nil
@@ -257,7 +262,7 @@ func prepareCEFLogFile(cfg config.CEFEngineConfig) (string, error) {
257 return "", fmt.Errorf("getwd: %w", cwdErr)262 return "", fmt.Errorf("getwd: %w", cwdErr)
258 }263 }
259 runtimeLogFile := filepath.Join(cwd, ".dev", "dumber", "logs", "cef_runtime.log")264 runtimeLogFile := filepath.Join(cwd, ".dev", "dumber", "logs", "cef_runtime.log")
260- if err := os.MkdirAll(filepath.Dir(runtimeLogFile), 0o755); err != nil {265+ if err := os.MkdirAll(filepath.Dir(runtimeLogFile), dirPerm); err != nil {
261 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(runtimeLogFile), err)266 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(runtimeLogFile), err)
262 }267 }
263 return runtimeLogFile, nil268 return runtimeLogFile, nil
@@ -279,10 +284,10 @@ func prepareCEFInitTraceFile(cfg config.CEFEngineConfig) (string, error) {
279 runtimeLogFile = filepath.Join(cwd, ".dev", "dumber", "logs", "cef_runtime.log")284 runtimeLogFile = filepath.Join(cwd, ".dev", "dumber", "logs", "cef_runtime.log")
280 }285 }
281 bootstrapLogFile := strings.TrimSuffix(runtimeLogFile, filepath.Ext(runtimeLogFile)) + ".bootstrap.log"286 bootstrapLogFile := strings.TrimSuffix(runtimeLogFile, filepath.Ext(runtimeLogFile)) + ".bootstrap.log"
282- if err := os.MkdirAll(filepath.Dir(bootstrapLogFile), 0o755); err != nil {287+ if err := os.MkdirAll(filepath.Dir(bootstrapLogFile), dirPerm); err != nil {
283 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(bootstrapLogFile), err)288 return "", fmt.Errorf("mkdir %s: %w", filepath.Dir(bootstrapLogFile), err)
284 }289 }
285- if err := os.WriteFile(bootstrapLogFile, nil, 0o644); err != nil {290+ if err := os.WriteFile(bootstrapLogFile, nil, filePerm); err != nil {
286 return "", fmt.Errorf("reset %s: %w", bootstrapLogFile, err)291 return "", fmt.Errorf("reset %s: %w", bootstrapLogFile, err)
287 }292 }
288 return bootstrapLogFile, nil293 return bootstrapLogFile, nil
M internal/infrastructure/cef/webview.go +2 -4
@@ -555,7 +555,6 @@ func (f cefTaskFunc) Execute() {
555555
556556 func (wv *WebView) scheduleZoomRefresh() {
557557 for _, delayMs := range [...]int64{16, 48} {
558- delayMs := delayMs
559558 purecef.PostDelayedTask(purecef.ThreadIDTidUi, purecef.NewTask(cefTaskFunc(func() {
560559 if wv.destroyed.Load() {
561560 return
@@ -573,7 +572,6 @@ func (wv *WebView) scheduleZoomRefresh() {
573572
574573 func (wv *WebView) scheduleZoomReadback(expectedFactor, expectedLevel float64) {
575574 for _, delayMs := range [...]int64{0, 64} {
576- delayMs := delayMs
577575 purecef.PostDelayedTask(purecef.ThreadIDTidUi, purecef.NewTask(cefTaskFunc(func() {
578576 if wv.destroyed.Load() {
579577 return
@@ -635,7 +633,7 @@ func (wv *WebView) startBeginFrameLoop() {
635633 return true
636634 }
637635 wv.beginFrameTick = cb
638- wv.beginFrameTickID = glArea.Widget.AddTickCallback(cb, 0, nil)
636+ wv.beginFrameTickID = glArea.AddTickCallback(cb, 0, nil)
639637 host := wv.host
640638 wv.mu.Unlock()
641639
@@ -657,7 +655,7 @@ func (wv *WebView) stopBeginFrameLoop() {
657655 wv.mu.Unlock()
658656
659657 if tickID != 0 {
660- glArea.Widget.RemoveTickCallback(tickID)
658+ glArea.RemoveTickCallback(tickID)
661659 }
662660 }
663661
@@ -555,7 +555,6 @@ func (f cefTaskFunc) Execute() {
555 555
556 func (wv *WebView) scheduleZoomRefresh() {556 func (wv *WebView) scheduleZoomRefresh() {
557 for _, delayMs := range [...]int64{16, 48} {557 for _, delayMs := range [...]int64{16, 48} {
558- delayMs := delayMs
559 purecef.PostDelayedTask(purecef.ThreadIDTidUi, purecef.NewTask(cefTaskFunc(func() {558 purecef.PostDelayedTask(purecef.ThreadIDTidUi, purecef.NewTask(cefTaskFunc(func() {
560 if wv.destroyed.Load() {559 if wv.destroyed.Load() {
561 return560 return
@@ -573,7 +572,6 @@ func (wv *WebView) scheduleZoomRefresh() {
573 572
574 func (wv *WebView) scheduleZoomReadback(expectedFactor, expectedLevel float64) {573 func (wv *WebView) scheduleZoomReadback(expectedFactor, expectedLevel float64) {
575 for _, delayMs := range [...]int64{0, 64} {574 for _, delayMs := range [...]int64{0, 64} {
576- delayMs := delayMs
577 purecef.PostDelayedTask(purecef.ThreadIDTidUi, purecef.NewTask(cefTaskFunc(func() {575 purecef.PostDelayedTask(purecef.ThreadIDTidUi, purecef.NewTask(cefTaskFunc(func() {
578 if wv.destroyed.Load() {576 if wv.destroyed.Load() {
579 return577 return
@@ -635,7 +633,7 @@ func (wv *WebView) startBeginFrameLoop() {
635 return true633 return true
636 }634 }
637 wv.beginFrameTick = cb635 wv.beginFrameTick = cb
638- wv.beginFrameTickID = glArea.Widget.AddTickCallback(cb, 0, nil)636+ wv.beginFrameTickID = glArea.AddTickCallback(cb, 0, nil)
639 host := wv.host637 host := wv.host
640 wv.mu.Unlock()638 wv.mu.Unlock()
641 639
@@ -657,7 +655,7 @@ func (wv *WebView) stopBeginFrameLoop() {
657 wv.mu.Unlock()655 wv.mu.Unlock()
658 656
659 if tickID != 0 {657 if tickID != 0 {
660- glArea.Widget.RemoveTickCallback(tickID)658+ glArea.RemoveTickCallback(tickID)
661 }659 }
662 }660 }
663 661
M internal/infrastructure/cef/webview_handlers_test.go +1 -1
@@ -95,7 +95,7 @@ func TestGetScreenInfoUsesDIPRectAndScale(t *testing.T) {
9595 ok := h.GetScreenInfo(nil, info)
9696
9797 require.Equal(t, int32(1), ok)
98- require.Equal(t, float32(3), info.DeviceScaleFactor)
98+ require.InEpsilon(t, float32(3), info.DeviceScaleFactor, 0.001)
9999 require.Equal(t, int32(500), info.Rect.Width)
100100 require.Equal(t, int32(300), info.Rect.Height)
101101 require.Equal(t, int32(500), info.AvailableRect.Width)
@@ -95,7 +95,7 @@ func TestGetScreenInfoUsesDIPRectAndScale(t *testing.T) {
95 ok := h.GetScreenInfo(nil, info)95 ok := h.GetScreenInfo(nil, info)
96 96
97 require.Equal(t, int32(1), ok)97 require.Equal(t, int32(1), ok)
98- require.Equal(t, float32(3), info.DeviceScaleFactor)98+ require.InEpsilon(t, float32(3), info.DeviceScaleFactor, 0.001)
99 require.Equal(t, int32(500), info.Rect.Width)99 require.Equal(t, int32(500), info.Rect.Width)
100 require.Equal(t, int32(300), info.Rect.Height)100 require.Equal(t, int32(300), info.Rect.Height)
101 require.Equal(t, int32(500), info.AvailableRect.Width)101 require.Equal(t, int32(500), info.AvailableRect.Width)
M internal/infrastructure/cef/webview_zoom_test.go +0 -1
@@ -16,4 +16,3 @@ func TestZoomConversionsRoundTrip(t *testing.T) {
1616 }
1717 }
1818 }
19-
@@ -16,4 +16,3 @@ func TestZoomConversionsRoundTrip(t *testing.T) {
16 }16 }
17 }17 }
18 }18 }
19-

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 8

Tags 42

↑↓ moveenter openesc close