Skip to content

HPNEX-14: feat(golang): rewrite plugin with gopls MCP server and gofmt hook - #449

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift-eng:mainfrom
cblecker:feat/golang-plugin-rewrite
May 6, 2026
Merged

openshift-merge-bot[bot] merged 2 commits into
openshift-eng:mainfrom
cblecker:feat/golang-plugin-rewrite

Conversation

@cblecker

@cblecker cblecker commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Rewrites the golang plugin (v0.1.0 → v0.2.0) to integrate the gopls MCP server for Go code intelligence (go-to-definition, find references, hover docs, workspace symbols)
  • Adds a PostToolUse hook that auto-runs gofmt -w -s on any .go file after write or edit operations
  • Replaces the old lint-fix slash command with dedicated golang:lint and golang:lint-fix skills; adds mcp-prohibited rule to .claudelint.yaml with gopls on the allowlist
  • Adds allowCrossMarketplaceDependenciesOn: ["claude-plugins-official"] to the marketplace, allowing the gopls-lsp dependency to be resolved from the official marketplace

Test plan

  • Install the golang plugin in a Go project and verify the gopls MCP server connects successfully
  • Edit a .go file and confirm gofmt runs automatically via the hook
  • Invoke /golang:lint-fix and confirm it discovers golangci-lint and applies fixes
  • Run make lint to confirm the repo itself passes linting after these changes
  • Run make update to verify marketplace.json and docs/data.json are consistent

Summary by CodeRabbit

  • New Features

    • Golang plugin adds LSP integration (gopls), auto-format-on-edit, and expanded linting skills (lint + lint-fix).
  • Updates

    • Golang plugin bumped to v0.2.0 with an improved description and reorganized documentation.
  • Configuration

    • Marketplace now allows cross-marketplace plugin dependencies and settings enable new plugins.
  • Documentation

    • README and plugin docs rewritten to reflect the new workflow and usage.

Update .gitignore to track .claude/settings.json while ignoring other
Claude state files.

Assisted-by: Claude:claude-sonnet-4-6[1m]
@openshift-ci
openshift-ci Bot requested review from bryan-cox and enxebre May 6, 2026 18:24
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2026
@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 054d6d83-58e9-4e9e-8556-2c0cdcf0c1bf

📥 Commits

Reviewing files that changed from the base of the PR and between 441b45f and a4151ea.

📒 Files selected for processing (12)
  • .claude-plugin/marketplace.json
  • .claudelint.yaml
  • PLUGINS.md
  • docs/data.json
  • plugins/golang/.claude-plugin/plugin.json
  • plugins/golang/.mcp.json
  • plugins/golang/README.md
  • plugins/golang/commands/lint-fix.md
  • plugins/golang/hooks/hooks.json
  • plugins/golang/hooks/scripts/gofmt.sh
  • plugins/golang/skills/lint-fix/SKILL.md
  • plugins/golang/skills/lint/SKILL.md
💤 Files with no reviewable changes (2)
  • plugins/golang/commands/lint-fix.md
  • PLUGINS.md

Walkthrough

Updates the Go plugin: bumps version to 0.2.0, adds gopls MCP server and a gopls-lsp dependency, converts command surface to skills (lint and lint-fix), adds PostToolUse gofmt hooks and script, adjusts marketplace/settings/claudelint, and updates docs and plugin manifests.

Changes

Go Plugin Enhancement

Layer / File(s) Summary
Marketplace / Settings
.claude-plugin/marketplace.json, .claude/settings.json
Adds top-level allowCrossMarketplaceDependenciesOn and enables two official plugins in .claude/settings.json.
Plugin Manifest
plugins/golang/.claude-plugin/plugin.json
Plugin golang description updated, version bumped to 0.2.0, and dependencies added (gopls-lsp referencing claude-plugins-official).
Public Metadata
docs/data.json
Public plugin block updated: description, version 0.2.0, commands emptied, skills expanded to lint and lint-fix, and a PostToolUse hook added.
MCP Server
plugins/golang/.mcp.json
New MCP server entry for gopls with command gopls and args ["mcp"].
Hooks & Formatter Script
plugins/golang/hooks/hooks.json, plugins/golang/hooks/scripts/gofmt.sh
New PostToolUse hooks for Write/Edit events invoking gofmt.sh (matcher for .go files, 10s timeout). gofmt.sh reads tool_input.file_path and runs gofmt -w -s on the path.
Skills & Skill Docs
plugins/golang/skills/lint/SKILL.md, plugins/golang/skills/lint-fix/SKILL.md
Introduces YAML front matter for lint skill and adds a new lint-fix skill with Discovery, Fix Process, and Guidelines documented.
Docs & Command Removal
plugins/golang/README.md, plugins/golang/commands/lint-fix.md, PLUGINS.md
README rewritten to describe LSP, gofmt hooks, and skills. commands/lint-fix.md deleted. PLUGINS.md list ordering/lines adjusted.
Configuration / Linting Rules
.claudelint.yaml
Adds mcp-prohibited rule under MCP rules with gopls in allowlist.
Repository Ignores
.gitignore
Refines .claude/ ignores to allow .claude/settings.json and adds *.local.* ignore pattern.

Sequence Diagram(s)

sequenceDiagram
    participant Agent
    participant MCP as gopls (MCP Server)
    participant HooksRunner
    participant Formatter as gofmt.sh
    participant FS as FileSystem

    Agent->>MCP: invoke tooling (MCP request)
    MCP-->>Agent: tool result (e.g., edits or file path)
    Agent->>HooksRunner: PostToolUse event (Write/Edit)
    HooksRunner->>Formatter: pass JSON payload (tool_input.file_path)
    Formatter->>FS: run `gofmt -w -s` on file
    FS-->>Formatter: file updated
    Formatter-->>HooksRunner: exit status
    HooksRunner-->>Agent: hook result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: rewriting the golang plugin to integrate gopls MCP server and add a gofmt hook, which aligns with the primary objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No Real People Names In Style References ✅ Passed No references to real people names found in plugin commands, skill documentation, example prompts, or style references. All content uses technical descriptions and tool names.
No Assumed Git Remote Names ✅ Passed No hardcoded git remote names found. References to "origin"/"upstream" are to the OpenShift origin plugin, not git remotes. No git commands assume specific remote names.
Git Push Safety Rules ✅ Passed No unsafe git operations found in PR. All modified files (golang plugin, configuration, skills, hooks, scripts) contain no git push, force push, or autonomous git operations.
No Untrusted Mcp Servers ✅ Passed PR introduces only gopls MCP server from official sources: gopls-lsp from claude-plugins-official marketplace, maintained by Go team. No untrusted, arbitrary, or random MCP servers present.
Ai-Helpers Overlap Detection ✅ Passed No overlapping functionality detected. golang:lint and golang:lint-fix skills are distinct from code-review/skills/lang-go. Repository-wide scan confirms no conflicting linting skills elsewhere.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/data.json`:
- Around line 1708-1715: Find the skill entries where "id" is "lint" and
"lint-fix" whose "description" is the YAML artifact string ">-" and replace that
value with a proper user-facing description (or an empty string/remove the
description property) so the docs renderer won't show the leaked YAML marker;
update the "description" field for the "lint" and "lint-fix" objects
accordingly.

In `@plugins/golang/README.md`:
- Around line 25-33: The Prerequisites section of plugins/golang/README.md only
lists gopls and gofmt but omits golangci-lint which the skills rely on; update
the Prerequisites (and the repeated block around lines 37-46) to include
golangci-lint as a required or optional dependency and give the install command
(e.g., go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
and a brief note that some checks in the skills expect it to be present so users
won’t be surprised during setup.

In `@plugins/golang/skills/lint/SKILL.md`:
- Around line 35-50: The two unlabeled fenced code blocks in
plugins/golang/skills/lint/SKILL.md (the example "Found 15 issues" block and the
"Code passes all linter checks" block) should include a language tag to satisfy
markdownlint MD040; update both opening fences to use a tag like ```text (or
```none) so the blocks become ```text ... ``` instead of just ```, keeping the
block content unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 70ed958b-13fe-4e78-a293-505f963c1d4b

📥 Commits

Reviewing files that changed from the base of the PR and between b56bad0 and 441b45f.

📒 Files selected for processing (14)
  • .claude-plugin/marketplace.json
  • .claude/settings.json
  • .claudelint.yaml
  • .gitignore
  • PLUGINS.md
  • docs/data.json
  • plugins/golang/.claude-plugin/plugin.json
  • plugins/golang/.mcp.json
  • plugins/golang/README.md
  • plugins/golang/commands/lint-fix.md
  • plugins/golang/hooks/hooks.json
  • plugins/golang/hooks/scripts/gofmt.sh
  • plugins/golang/skills/lint-fix/SKILL.md
  • plugins/golang/skills/lint/SKILL.md
💤 Files with no reviewable changes (2)
  • plugins/golang/commands/lint-fix.md
  • PLUGINS.md

Comment thread docs/data.json Outdated
Comment thread plugins/golang/README.md
Comment thread plugins/golang/skills/lint/SKILL.md Outdated
Replaces the golangci-lint command and skill with gopls LSP integration
via .mcp.json, a PostToolUse hook for automatic gofmt formatting, and a
dependency on the gopls-lsp plugin from claude-plugins-official.
Allowlists gopls in .claudelint.yaml mcp-prohibited rule.

Assisted-by: Claude:claude-sonnet-4-6[1m]
@cblecker
cblecker force-pushed the feat/golang-plugin-rewrite branch from 441b45f to a4151ea Compare May 6, 2026 18:41
@cblecker

cblecker commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

/retest

2 similar comments
@cblecker

cblecker commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

/retest

@cblecker

cblecker commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

/retest

@bryan-cox bryan-cox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2026
@openshift-ci

openshift-ci Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, cblecker

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@bryan-cox

Copy link
Copy Markdown
Contributor

/test images

@cblecker

cblecker commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

/retest

@openshift-merge-bot
openshift-merge-bot Bot merged commit d2de5a1 into openshift-eng:main May 6, 2026
5 checks passed
@cblecker
cblecker deleted the feat/golang-plugin-rewrite branch May 6, 2026 20:57
@stbenjam stbenjam changed the title feat(golang): rewrite plugin with gopls MCP server and gofmt hook HPNEX-14: feat(golang): rewrite plugin with gopls MCP server and gofmt hook May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants