gone

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 1 Imported by: 0

README

gone

Fast, concurrent dead link detector for markdown files.

Test Lint Go Report Card

Scan your markdown files for broken links. gone finds all HTTP/HTTPS URLs, checks if they're still alive, and helps you fix the ones that aren't.

gone

Here's a list of powerful features:

  • Fast concurrent checking. Check hundreds of URLs at the same time. Configure the number of workers based on your network. Large documentation sites take seconds, not minutes.

  • Interactive terminal UI. Watch progress in real-time. Navigate results with vim-style keys, filter by status, and explore issues without leaving your terminal. It's like htop for your links.

  • Automatic redirect fixing. Found a redirect? gone fix updates your markdown to use the final URL. Preview changes first with --dry-run, confirm each file interactively, or let it fix everything with --yes.

  • Smart deduplication. Same URL in 50 files? It gets checked once. Results map back to every occurrence. Less waiting, fewer rate limits.

  • Flexible ignore rules. Skip localhost, staging environments, or that one URL that's always flaky. Use domains, glob patterns, or regex. Set them in .gonerc.yaml or pass them as flags.

  • Multiple output formats. JSON, YAML, XML, JUnit, Markdown—pick your favorite. The format is auto-detected from the file extension, or set it explicitly with --format.

  • Markdown-aware parsing. Finds links in [text](url), reference-style [text][ref], autolinks <url>, and HTML <a> tags. Knows to skip URLs inside code blocks.

  • CI/CD friendly. Exit code 0 means all good. Exit code 1 means dead links. JUnit output works with GitHub Actions, GitLab CI, Jenkins, and everything else.

Table of Contents

Installation

Go Install
go install github.com/leonardomso/gone@latest
Homebrew (coming soon)
brew install leonardomso/tap/gone
Build from Source
git clone https://github.com/leonardomso/gone.git
cd gone
go build
Download Binary

Download the latest release from the GitHub Releases page.

Quick Start

# Scan current directory
gone check

# Scan specific directory
gone check ./docs

# Output as JSON
gone check --format=json

# Launch interactive TUI
gone interactive

# Auto-fix redirect URLs
gone fix

Commands

gone check

Scan markdown files for dead links.

gone check [path] [flags]

Flags:

Flag Short Default Description
--format -f Output format: json, yaml, xml, junit, markdown
--output -o Write report to file (format inferred from extension)
--all -a false Show all results including alive links
--dead -d false Show only dead links and errors
--warnings -w false Show only warnings (redirects, blocked)
--alive false Show only alive links
--concurrency -c 10 Number of concurrent workers
--timeout -t 10 Timeout per request in seconds
--retries -r 2 Number of retries for failed requests
--ignore-domain Domains to ignore (comma-separated or repeated)
--ignore-pattern Glob patterns to ignore
--ignore-regex Regex patterns to ignore
--show-ignored false Show which URLs were ignored
--no-config false Skip loading .gonerc.yaml

Link Status Types:

Status Description
Alive Link returned a 2xx response. All good.
Redirect Link redirected (301, 302, 307, 308) but final destination is alive. Consider updating to the final URL.
Blocked Server returned 403. Might be bot detection. Link may still work in a browser.
Dead Link is broken (4xx, 5xx, or redirect chain ends in error).
Error Network error: timeout, DNS failure, or connection refused.
Duplicate Same URL appears multiple times. Checked once, result shared.

Examples:

# Scan with JSON output to stdout
gone check --format=json

# Write JUnit report for CI
gone check --output=report.junit.xml

# Show only dead links
gone check --dead

# Increase concurrency for faster scanning
gone check --concurrency=20

# Ignore specific domains
gone check --ignore-domain=localhost,example.com
gone interactive

Launch an interactive terminal UI with real-time progress.

gone interactive [path] [flags]

Flags:

Flag Default Description
--ignore-domain Domains to ignore
--ignore-pattern Glob patterns to ignore
--ignore-regex Regex patterns to ignore
--no-config false Skip loading .gonerc.yaml

Controls:

Key Action
/ k Move up
/ j Move down
PgUp / Ctrl+U Page up
PgDn / Ctrl+D Page down
g / Home Go to start
G / End Go to end
f Cycle filter (All → Warnings → Dead → Duplicates)
? Toggle help
q / Ctrl+C Quit
gone fix

Automatically fix redirect URLs in markdown files.

gone fix [path] [flags]

Flags:

Flag Short Default Description
--yes -y false Apply all fixes without prompting
--dry-run -n false Preview changes without modifying files
--concurrency -c 10 Number of concurrent workers
--timeout -t 10 Timeout per request in seconds
--retries -r 2 Number of retries for failed requests
--ignore-domain Domains to ignore
--ignore-pattern Glob patterns to ignore
--ignore-regex Regex patterns to ignore
--no-config false Skip loading .gonerc.yaml

Examples:

# Interactive mode - prompt for each file
gone fix

# Preview what would be fixed
gone fix --dry-run

# Apply all fixes automatically
gone fix --yes
gone completion

Generate shell autocompletion scripts.

gone completion [shell]

Supported Shells:

Shell Command
Bash gone completion bash
Zsh gone completion zsh
Fish gone completion fish
PowerShell gone completion powershell

Setup Examples:

# Bash (add to ~/.bashrc)
source <(gone completion bash)

# Zsh (add to ~/.zshrc)
source <(gone completion zsh)

# Fish
gone completion fish | source

Configuration

Config File

Create a .gonerc.yaml file in your project root:

ignore:
  # Ignore entire domains (includes subdomains)
  domains:
    - localhost
    - example.com
    - staging.myapp.com

  # Glob patterns
  patterns:
    - "*.local/*"
    - "*/internal/*"

  # Regular expressions
  regex:
    - ".*\\.(test|dev)$"
    - "192\\.168\\..*"
CLI Flags

CLI flags are additive with config file settings:

# These are combined with .gonerc.yaml settings
gone check --ignore-domain=api.example.com --ignore-pattern="*.internal/*"

Output Formats

JSON
gone check --format=json
# or
gone check --output=report.json
YAML
gone check --format=yaml
# or
gone check --output=report.yaml
JUnit XML (for CI/CD)
gone check --output=report.junit.xml
Markdown
gone check --format=markdown
# or
gone check --output=report.md

CI/CD Integration

GitHub Actions
name: Check Links

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]
  schedule:
    - cron: '0 0 * * 0'  # Weekly

jobs:
  check-links:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: '1.25.5'

      - name: Install gone
        run: go install github.com/leonardomso/gone@latest

      - name: Check links
        run: gone check --output=report.junit.xml

      - name: Upload report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: link-report
          path: report.junit.xml

Exit Codes

Code Meaning
0 All links are alive (or only warnings)
1 Dead links or errors found
2 User quit interactive fix mode

Reference

Commands Overview
Command Description
gone check [path] Scan markdown files and report dead links
gone fix [path] Find redirects and update URLs to final destinations
gone interactive [path] Launch terminal UI for interactive exploration
gone completion [shell] Generate shell autocompletion (bash, zsh, fish, powershell)
gone help [command] Show help for any command
Flags Reference
Flag Commands Default Description
-f, --format check Output format (json, yaml, xml, junit, markdown)
-o, --output check Write report to file
-a, --all check false Show all results including alive
-d, --dead check false Show only dead links
-w, --warnings check false Show only warnings
--alive check false Show only alive links
--show-ignored check false Show ignored URLs
-y, --yes fix false Apply fixes without prompting
-n, --dry-run fix false Preview changes only
-c, --concurrency check, fix 10 Concurrent workers
-t, --timeout check, fix 10 Request timeout (seconds)
-r, --retries check, fix 2 Retry attempts
--ignore-domain all Domains to ignore
--ignore-pattern all Glob patterns to ignore
--ignore-regex all Regex patterns to ignore
--no-config all false Skip .gonerc.yaml
-h, --help all Show help
-v, --version root Show version

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
checker
Package checker verifies if URLs are alive by making HTTP requests.
Package checker verifies if URLs are alive by making HTTP requests.
config
Package config handles loading configuration from .gonerc.yaml files.
Package config handles loading configuration from .gonerc.yaml files.
filter
Package filter provides URL filtering based on domains and patterns.
Package filter provides URL filtering based on domains and patterns.
fixer
Package fixer provides functionality to automatically fix redirect URLs in markdown files.
Package fixer provides functionality to automatically fix redirect URLs in markdown files.
output
Package output provides formatting and file writing for link check reports.
Package output provides formatting and file writing for link check reports.
parser
Package parser extracts URLs from markdown content using goldmark.
Package parser extracts URLs from markdown content using goldmark.
scanner
Package scanner finds markdown files in a directory
Package scanner finds markdown files in a directory
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL