Unverified Commit a05edc93 authored by Lemon-miaow's avatar Lemon-miaow
Browse files

chore: gofmt the tree, clear staticcheck, add a CI gofmt gate

Nine files had drifted from gofmt and nothing checked; nine staticcheck
findings were live (three dead symbols, capitalization, a redundant
Sprintf, two literal-to-conversion sites, a nil test context). Fix all
of them and make CI fail on unformatted Go so this cannot re-drift.
parent a56c3265
Loading
Loading
Loading
Loading
+6 −0
Changes for .github/workflows/ci.yml: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -36,6 +36,12 @@ jobs:
        with:
          go-version-file: go.mod

      - name: gofmt
        run: |
          unformatted=$(gofmt -l .)
          if [ -n "$unformatted" ]; then
            echo "gofmt needed on:"; echo "$unformatted"; exit 1
          fi
      - run: go vet ./...
      - run: go test ./...

+1 −1
Changes for cmd/felis/backupnow.go: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ func resolveInternalAPI(ctx context.Context, cl client.Client, controlNamespace
	}
	token = string(sec.Data[naming.ServiceTokenSecretKey])
	if token == "" {
		return "", "", fmt.Errorf("Secret %s has no %s key", naming.ServiceTokenSecretName, naming.ServiceTokenSecretKey)
		return "", "", fmt.Errorf("secret %s has no %s key", naming.ServiceTokenSecretName, naming.ServiceTokenSecretKey)
	}

	return fmt.Sprintf("http://%s:%d", ip, platform.APIInternalPort), token, nil
+0 −2
Changes for cmd/felis/breakglass.go: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -575,8 +575,6 @@ type breakGlassResult struct {
	edgeAud         string
	edgeRoutedHosts []string
	edgeConfigPath  string
	edgePanelHostname string
	edgeAdminHostname string
}

type consoleMode string
+0 −1
Changes for internal/api/api.go: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -677,7 +677,6 @@ type cooldownLimiter struct {
	mu   sync.Mutex
	now  func() time.Time
	last map[string]time.Time
	window time.Duration
}

// allowed reports whether name may wake now WITHOUT recording the attempt. A
+1 −1
Changes for internal/api/api_test.go: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ func (f *fakeRepo) QuotaCheck(_ context.Context, userID string, _ string, _ Reso
	// For hermetic tests, QuotaCheck delegates to the same QuotaAvailable
	// store — tests that care about per-dimension checks should use
	// fakeQuotas with direct inspection.
	return f.QuotaAvailable(nil, userID)
	return f.QuotaAvailable(context.TODO(), userID)
}

func (f *fakeRepo) UpdateServerResources(_ context.Context, _ string, _, _, _ int) error { return nil }
Loading