Skip to content

refactor: clear the gopls and go fix findings in cmd, herdrplugin and fang - #1539

Merged
Gaurav-Gosain merged 4 commits into
mainfrom
refactor/cmd-herdrplugin-fang-findings
Nov 4, 2026
Merged

Gaurav-Gosain merged 4 commits into
mainfrom
refactor/cmd-herdrplugin-fang-findings

Conversation

@Gaurav-Gosain

Copy link
Copy Markdown
Owner

The gopls and go fix findings in cmd/ and the smaller internal packages, outside app and session. One commit per package. The linux text section is 192 bytes smaller.

Scope

  • cmd/tuios: gopls flagged the string concatenation inside WriteString in lookPicker.View. One fmt.Fprintf writes the row now. View is 160 bytes smaller. Five separate WriteString calls, the form gopls suggests, made it 790 bytes larger, so I did not use them.
  • cmd/sketch-wasm: failure matches *sketch.Error with errors.AsType. go fix reports it only for js/wasm.
  • internal/herdrplugin: PathComponent trims the trailing dot with strings.CutSuffix. It returns the same string.
  • internal/fang: fang_windows.go drops its // +build windows line. The //go:build line above it is the one the toolchain reads. go fix reports it only for windows.

How I found them

go fix -diff ./... for linux, windows, darwin, freebsd, js/wasm (with the modfile the wasm build uses) and -tags ghostty, and gopls check on every Go file in cmd/ and internal/ outside app and session. This pull request takes every finding in those packages except the ones in #1538 and two I left out on purpose, which #1538 explains.

Verification

  • just check --changed passes, fix included.
  • go test passes for cmd/tuios and internal/herdrplugin. go vet passes for cmd/sketch-wasm with GOOS=js and for internal/fang with GOOS=windows.
  • Binary size with the release flags, against main at 57150e1: linux/amd64 46,919,840 bytes before and after, darwin/arm64 43,707,106 before and after. Text section on linux: 23,854,609 to 23,854,417 bytes.
  • No hot path changes: the look picker draws on a key press.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Binary size

target this change main change room under the ceiling
darwin/arm64 43724354 bytes 43724354 bytes +0 bytes (+0.0 KiB) 3275646 bytes
linux/amd64 46944416 bytes 46944416 bytes +0 bytes (+0.0 KiB) 55584 bytes

The ceiling is 47000000 bytes for each target. Main's size is from main at c606b6b (https://github.com/Gaurav-Gosain/tuios/actions/runs/41818148802).

State the size cost in the pull request body. CI fails only above the ceiling.

go fix suggested it. PathComponent returns the same string.
The //go:build line above it is the one the toolchain reads since Go 1.17.
go fix removes the old form on windows.
go fix suggested it for js/wasm. failure fills the same fields.
gopls flagged the string concatenation inside WriteString. Fprintf writes
the parts into the builder without the temporary string, and View is 160
bytes smaller. Five WriteString calls would have made it 790 bytes larger.
@Gaurav-Gosain
Gaurav-Gosain force-pushed the refactor/cmd-herdrplugin-fang-findings branch from 9b018b5 to 2e45da3 Compare November 4, 2026 11:21
@Gaurav-Gosain
Gaurav-Gosain merged commit 2e45da3 into main Nov 4, 2026
24 checks passed
@Gaurav-Gosain
Gaurav-Gosain deleted the refactor/cmd-herdrplugin-fang-findings branch November 4, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant