Skip to content

chore(lint): pin golangci-lint to v1.64.8 in CI + make target#18

Merged
kevinelliott merged 1 commit intomainfrom
chore/pin-golangci-lint
Apr 21, 2026
Merged

chore(lint): pin golangci-lint to v1.64.8 in CI + make target#18
kevinelliott merged 1 commit intomainfrom
chore/pin-golangci-lint

Conversation

@kevinelliott
Copy link
Copy Markdown
Owner

Summary

Prevents the class of failure we hit on PR #16, where CI used golangci-lint@latest and picked up rules that make lint never flagged locally. Both CI and Makefile now install the exact same version (v1.64.8); bumping is a single-line change in two places, kept literal on both sides for discoverability.

Changes

CI (.github/workflows/ci.yml): pin version: v1.64.8 with a comment pointing to the Makefile counterpart.

Makefile (lint target):

  • installs the pinned version into $(GOBIN) if missing or mismatched
  • normalizes version strings (leading v optional) before comparing
  • runs the installed binary by absolute $(GOBIN)/golangci-lint so mise/asdf PATH shims don't win
  • adds GOLANGCI_LINT_VERSION variable at the top

Systray: moved darwin-only uninstallCLI into a build-tagged file internal/systray/cli_uninstall_darwin.go. Removes the stale //nolint:unused // Reserved for future use that was only stale on darwin (the caller has //go:build darwin, so linux/windows saw the function as genuinely unused). No behavior change.

Test plan

  • make lint on darwin → passes (previously failed on stale nolint)
  • make lint on linux → passes (CI verifies)
  • make lint with no prior golangci-lint installed → installs v1.64.8 and runs
  • make lint with a different version installed → reinstalls v1.64.8

🤖 Generated with Claude Code

Prevents the class of failure where CI pulls a newer golangci-lint that
introduces rules the local `make lint` never sees. Both CI and Makefile
now install the exact same version; bumping is a single-line change in
two places (kept literal on both sides for discoverability).

The Makefile target:
- installs the pinned version into $(GOBIN) if missing or mismatched
- normalizes the version string (with/without leading v) before compare
- runs the installed binary by absolute path so mise/asdf shims don't
  win the PATH race

While here, move the darwin-only uninstallCLI out of systray.go into a
build-tagged file so //nolint:unused is no longer needed and `make lint`
passes identically on darwin and linux. No behavior change — the
function's only caller already has //go:build darwin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 21, 2026 06:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pins golangci-lint to a specific version so local make lint results match CI, and narrows a systray uninstall helper to darwin-only builds.

Changes:

  • Pin golangci-lint to v1.64.8 in CI and in the Makefile’s lint target.
  • Update make lint to install/reinstall the pinned linter version into $(GOBIN) and run it via an absolute path.
  • Move uninstallCLI out of internal/systray/systray.go into a darwin build-tagged file.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/systray/systray.go Removes uninstallCLI from the shared systray implementation.
internal/systray/cli_uninstall_darwin.go Adds darwin-only implementation of uninstallCLI.
Makefile Pins golangci-lint version and ensures make lint installs/runs that exact version.
.github/workflows/ci.yml Pins golangci-lint action to v1.64.8 to match local linting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
Comment on lines 12 to +16
GOBIN ?= $(shell go env GOPATH)/bin

# Pinned tool versions (keep in sync with .github/workflows/ci.yml)
GOLANGCI_LINT_VERSION ?= v1.64.8

Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOBIN is derived from go env GOPATH, but GOPATH can be a list (colon-separated). With the updated lint target running $(GOBIN)/golangci-lint by absolute path, a multi-entry GOPATH would produce an invalid GOBIN like path1:path2/bin and break linting. Consider deriving GOBIN from go env GOBIN (and falling back to the first GOPATH entry when empty) so $(GOBIN) is always a single valid directory.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +44
func (a *App) uninstallCLI() bool {
targetPath := "/usr/local/bin/agentmgr"

switch a.platform.ID() {
case platform.Darwin, platform.Linux:
// Use osascript to run sudo with password prompt
script := fmt.Sprintf(`
do shell script "rm -f '%s'" with administrator privileges
`, targetPath)

cmd := exec.Command("osascript", "-e", script)
err := cmd.Run()
if err != nil {
return false
}

// Clear config path
a.config.Helper.CLIPath = ""
if a.configLoader != nil {
_ = a.configLoader.SetAndSave("helper.cli_path", "")
}
return true

case platform.Windows:
// Try to remove directly on Windows
targetPath = filepath.Join(os.Getenv("LOCALAPPDATA"), "agentmgr", "agentmgr.exe")
if err := os.Remove(targetPath); err != nil {
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is //go:build darwin, so at runtime a.platform.ID() should always be platform.Darwin (it’s based on runtime.GOOS). The platform.Linux and platform.Windows branches are effectively dead code in this build, and they keep extra imports and platform-specific paths around unnecessarily. Consider simplifying the function to the darwin-only uninstall path (and removing the switch/unused branches) to avoid confusion and reduce maintenance surface.

Copilot uses AI. Check for mistakes.
@kevinelliott kevinelliott merged commit f039a57 into main Apr 21, 2026
19 checks passed
kevinelliott added a commit that referenced this pull request Apr 21, 2026
Promote the Unreleased section to 1.1.0 and capture everything landed
since v1.0.24: the parallel version-check perf work (#16), the
google.golang.org/grpc CVE-2026-33186 security bump (#17), the
golangci-lint pinning (#18), and the shared detect+version-check
pipeline refactor (#19).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants