跳到正文
TakoAPI
返回技能列表

gopls-lsp

由 bowen31337 提供

Coding Agents & IDEs
880下载量由 clawskills.sh 提供
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Go language server (gopls) providing code intelligence, refactoring, and analysis for .go files.

描述

该技能的功能

gopls is the official Go language server, providing code intelligence for .go files via the LSP protocol. It handles autocomplete, go-to-definition, find references, real-time error diagnostics, and refactoring like symbol renaming and import organization.

As the official Go language server maintained by the Go team, it stays current with new language features and provides more accurate analysis than third-party alternatives.

何时使用

  • Navigating to a function definition in a large Go codebase
  • Renaming a struct field across all files in a module
  • Catching type errors before running go build
  • Automatically organizing imports while editing a file
  • Finding all callers of an interface method

示例工作流

输入

User asks: rename the UserID field in the User struct to ID across the entire project

智能体
  1. 1

    gopls locates all references to UserID across .go files in the module

  2. 2

    Checks for naming conflicts the rename would introduce

  3. 3

    Applies the rename atomically across all affected files

  4. 4

    Reports the count of files and occurrences updated

输出

All references to UserID replaced with ID across the project, no conflicts introduced

前置要求

  • gopls installed via `go install golang.org/x/tools/gopls@latest` with $GOPATH/bin (or $HOME/go/bin) added to PATH

安装

clawhub install bowen31337/gopls-lsp

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接