fix: staticcheck and deadcode findings repo-wide, modernize counting loops

This commit is contained in:
2026-08-29 15:25:15 +02:00
parent 9a34733615
commit eacf33d0f7
33 changed files with 88 additions and 250 deletions
+7 -2
View File
@@ -5,8 +5,9 @@ package lint
import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
"sourcedock.dev/petrbalvin/gasm-devkit/arch"
@@ -24,7 +25,11 @@ import (
// assembler accepts. Advisory warnings are reported but not fatal, since they
// are heuristics that may legitimately differ across Go versions.
func TestGoRuntimeCorpus(t *testing.T) {
dir := filepath.Join(runtime.GOROOT(), "src", "runtime")
out, err := exec.Command("go", "env", "GOROOT").Output()
if err != nil {
t.Skipf("cannot locate GOROOT: %v", err)
}
dir := filepath.Join(strings.TrimSpace(string(out)), "src", "runtime")
var files []string
for _, suffix := range []string{"_amd64.s", "_arm64.s", "_riscv64.s", "_loong64.s"} {
matches, _ := filepath.Glob(filepath.Join(dir, "*"+suffix))