Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Go Usage FinderNew to Visual Studio Code? Get it now.
Go Usage Finder

Go Usage Finder

chenyihui

|
6 installs
| (0) | Free
Find all references (read/write) for Go symbols across project, GOROOT, and external libraries
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Go Usage Finder

A powerful VSCode extension that finds all references (read/write) for Go symbols (fields, functions, variables) across your entire codebase, including GOROOT and external libraries.

Features

  • 🔍 Comprehensive Reference Search: Find all references to Go symbols across:

    • Current workspace/project
    • GOROOT (Go standard library)
    • External libraries (go modules)
  • 📖 Read/Write Distinction: Clearly distinguishes between:

    • Read references: Variable/field reads, function calls
    • Write references: Assignments, increments/decrements, mutations
  • 🎯 Bottom Panel View: Dedicated panel at the bottom showing references organized by:

    • Reference type (Read/Write)
    • Scope (Workspace/GOROOT/External Libraries)
    • Hierarchical directory structure
    • File nodes with reference counts
  • ⚡ Quick Navigation: Click any reference to preview it side-by-side without losing focus

  • 👁️ Peek View Preview: View references in a floating preview window without leaving your current file

Installation

From VSCode Marketplace

  1. Open VSCode
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "Go Usage Finder"
  4. Click Install

From VSIX

  1. Download the .vsix file
  2. Open VSCode
  3. Go to Extensions
  4. Click "..." menu → "Install from VSIX..."
  5. Select the downloaded file

Requirements

  • VSCode 1.85.0 or higher
  • Go installed and available in PATH
  • Go extension for VSCode (recommended)
  • gopls (Go language server) installed for enhanced searching

Installation

From Source

  1. Clone or download this repository
  2. Open the folder in VSCode
  3. Run npm install to install dependencies
  4. Run npm run compile to compile the extension
  5. Press F5 to launch the extension in debug mode

Installing gopls (if not already installed)

go install golang.org/x/tools/gopls@latest

Usage

Finding References

Method 1: Tree View (Full List)

  1. Open a Go file in VSCode
  2. Place your cursor on a variable, function, or field name
  3. Right-click and select "Go: Find All References (Read/Write)"
    • Or use the command palette (Cmd+Shift+P / Ctrl+Shift+P) and search for "Go: Find All References"
  4. View results in the "Go References" panel at the bottom

Method 2: Peek View (Quick Preview)

  1. Place your cursor on a symbol
  2. Right-click and select "Show References in Peek View"
  3. A floating window will show all references with inline code preview
  4. Navigate with arrow keys, press Enter to jump to a reference

Viewing Results

Bottom Panel: The extension displays results in the "Go References" panel at the bottom of the window:

  • 📖 Read References: Shows all places where the symbol is read or called (blue eye icon)
  • ✏️ Write References: Shows all places where the symbol is modified (red edit icon)
  • 📁 Workspace: References in your current project
  • 🔧 GOROOT: References in Go standard library
  • 📦 External Libraries: References in third-party modules

The panel shows a hierarchical structure:

  • Folders: Organized by directory path
  • Files: Each file shows reference count
  • References: Line number with code snippet preview (first 60 characters)
  • Hover over any item to see full path

Peek View: The peek view shows a floating window with:

  • All references listed on the left
  • Full code context on the right
  • Syntax highlighting
  • Quick navigation with keyboard

Navigation

From Bottom Panel:

  • Click on any reference to preview it side-by-side in the right editor
  • The preview opens without stealing focus from the panel
  • Hover over references to see the full file path and code context
  • Use the refresh button (top-right of panel) to re-run the search
  • Expand/collapse folders to navigate the directory structure

From Peek View:

  • Use arrow keys to navigate between references
  • Press Enter to jump to the selected reference
  • Press Escape to close the peek view
  • Click on any reference to open it in the editor

How It Works

The extension uses multiple strategies to find references:

  1. VSCode Built-in Provider: Uses VSCode's reference provider for fast local searches
  2. gopls Integration: Leverages the Go language server for comprehensive cross-package searches
  3. Scope Detection: Analyzes file paths to determine if references are in:
    • Workspace (your project files)
    • GOROOT (Go standard library)
    • External libraries (go.mod dependencies)
  4. Read/Write Analysis: Examines the code context to determine if a reference is a read or write operation

Configuration

No configuration required! The extension automatically detects your Go environment using go env.

Known Limitations

  • Write detection is heuristic-based and may not catch all edge cases
  • Very large codebases may take longer to search
  • Requires gopls for searching in external libraries

Troubleshooting

No references found in external libraries

  • Ensure gopls is installed: go install golang.org/x/tools/gopls@latest
  • Check that gopls is in your PATH
  • Try running gopls version in terminal to verify installation

Extension not activating

  • Ensure you're working with Go files (.go extension)
  • Check that the Go extension is installed and working

Development

Building

npm install
npm run compile

Running in Debug Mode

Press F5 in VSCode to launch the extension development host.

Project Structure

go-usage/
├── src/
│   ├── extension.ts          # Extension entry point
│   ├── usageProvider.ts      # Tree view provider
│   └── referenceFinder.ts    # Reference finding logic
├── package.json              # Extension manifest
└── tsconfig.json            # TypeScript configuration

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT

Changelog

0.0.1

  • Initial release
  • Find references across workspace, GOROOT, and external libraries
  • Read/Write distinction
  • Custom tree view for displaying results
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft