{"id":25436678,"url":"https://github.com/crgimenes/goscope","last_synced_at":"2025-05-15T03:10:53.793Z","repository":{"id":276560315,"uuid":"929620827","full_name":"crgimenes/GoScope","owner":"crgimenes","description":"GoScope is a CLI tool that scans Go projects, listing functions, constants, types, and function calls. Combined with rgs, it enables fast, interactive navigation using fzf.","archived":false,"fork":false,"pushed_at":"2025-02-12T03:45:15.000Z","size":700,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T08:23:23.642Z","etag":null,"topics":["bash","cli","code-explorer","code-navigation","code-search","command-line","developer-tools","fzf","go","golang","programming-tools","scripting"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crgimenes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-09T00:59:29.000Z","updated_at":"2025-02-12T03:45:18.000Z","dependencies_parsed_at":"2025-02-09T03:23:00.329Z","dependency_job_id":"fdd87c6d-68fa-4174-a651-8eb07c43059f","html_url":"https://github.com/crgimenes/GoScope","commit_stats":null,"previous_names":["crgimenes/goscope"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2FGoScope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2FGoScope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2FGoScope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2FGoScope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crgimenes","download_url":"https://codeload.github.com/crgimenes/GoScope/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264766,"owners_count":22041794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cli","code-explorer","code-navigation","code-search","command-line","developer-tools","fzf","go","golang","programming-tools","scripting"],"created_at":"2025-02-17T08:21:38.312Z","updated_at":"2025-05-15T03:10:48.782Z","avatar_url":"https://github.com/crgimenes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoScope \u0026 rgs\n\nGoScope (`goscope`) and rgs are two command-line tools designed to help Go developers quickly locate and navigate to functions, variables, constants, and types in Go projects. GoScope analyzes all `.go` files starting from the current directory (recursively), while rgs provides an interactive interface (via [fzf](https://github.com/junegunn/fzf)) to jump straight into your editor at the relevant line.\n\n![GoScope and rgs in action](goscope.png)\n\n## Table of Contents\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [GoScope](#goscope)\n  - [rgs](#rgs)\n- [Examples](#examples)\n- [Notes and Tips](#notes-and-tips)\n- [References](#references)\n\n## Features\n\n- **Automatic Scanning**: GoScope scans the current directory and all subdirectories for `.go` files.\n- **Comprehensive Listing**: It outputs:\n  - Declared functions (with file and line number).\n  - Declared variables and constants (with file and line number).\n  - Declared types (with file and line number).\n  - Function call occurrences in the format `Caller.Callee file:line`.\n- **Interactive Search**: The `rgs` script leverages `fzf` to allow fuzzy-searching any function, variable, constant, or type, and then opens the file at the exact line in your preferred text editor.\n\n## Requirements\n\n1. **GoScope**\n   - [Go](https://go.dev/) 1.23 or later (to compile the tool).\n   - A Unix-like shell environment (macOS, Linux, etc.).\n2. **rgs**\n   - [fzf](https://github.com/junegunn/fzf) for fuzzy searching.\n   - [bat](https://github.com/sharkdp/bat) (optional but highly recommended for colorful previews).\n   - An editor accessible via the `$EDITOR` environment variable (e.g., `vim`, `nvim`, etc.).\n   - A Unix-like shell (e.g., Bash, Zsh).\n\n## Installation\n\n1. **Clone or Download** this repository.\n2. **Build GoScope**:\n   ```bash\n   cd path/to/this/repo\n   go build -o goscope\n   ```\n   This produces an executable named `goscope`.\n3. **Install GoScope** (optional but recommended):\n   ```bash\n   mv goscope /usr/local/bin/\n   ```\n   Make sure `/usr/local/bin` is in your `$PATH`.\n4. **Install rgs**:\n   ```bash\n   chmod +x rgs\n   cp rgs /usr/local/bin/\n   ```\n   Again, confirm `/usr/local/bin` is in your `$PATH`.\n\n## Usage\n\n### GoScope\n\n- Simply run `goscope` in the terminal.\n- It scans the current directory recursively and prints all findings:\n  - Functions, variables, constants, and types in the format:\n    ```\n    FunctionName file.go:line\n    VariableName file.go:line\n    ConstantName file.go:line\n    TypeName file.go:line\n    ```\n  - Followed by function call mappings in the format:\n    ```\n    CallerName.CalleeName file.go:line\n    ```\n- There are **no command-line parameters** for GoScope: it always starts scanning from the current directory.\n\n### rgs\n\n- In the terminal, run:\n  ```bash\n  rgs\n  ```\n- This calls `goscope`, then pipes its output into `fzf`.\n- You can type partial names to filter results.\n- Use the arrow keys or your usual `fzf` navigation to select an item and press \u003ckbd\u003eEnter\u003c/kbd\u003e.\n- `rgs` then opens the corresponding file at the line where the item is declared (or called), using your editor set by `$EDITOR`.\n\n## Examples\n\nBelow is a simple Go code snippet to show how GoScope output might appear:\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n    fmt.Println(\"Hello World\")\n    PrintNumber(42)\n}\n\nfunc PrintNumber(num int) {\n    fmt.Printf(\"Number: %d\\n\", num)\n}\n```\n\n**Sample GoScope output**:\n```\nmain main.go:5\nPrintNumber main.go:10\nmain.Println main.go:6\nmain.PrintNumber main.go:7\nPrintNumber.Printf main.go:11\n```\n\n**Using rgs**:\n1. In your project directory, type:\n   ```bash\n   rgs\n   ```\n2. Type `PrintNum` in the search prompt, and select the result.\n3. Press \u003ckbd\u003eEnter\u003c/kbd\u003e to open the file at the corresponding line.\n\n## Notes and Tips\n\n- Ensure `goscope` is in your `$PATH` so that `rgs` can invoke it properly.\n- If `bat` is not installed, you may remove or modify the preview command in `rgs`.\n- If `$EDITOR` is not set, you can either set it before running `rgs`, or update the script to call your favorite editor directly.\n\n## References\n\n- [Official Go Documentation](https://go.dev/doc/)\n- [fzf on GitHub](https://github.com/junegunn/fzf)\n- [bat on GitHub](https://github.com/sharkdp/bat)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrgimenes%2Fgoscope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrgimenes%2Fgoscope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrgimenes%2Fgoscope/lists"}