Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 28, 2026·3 min de lectura

Revive — Fast and Extensible Go Linter

Revive is a fast, configurable Go linter that serves as a drop-in replacement for golint. It supports custom rules, TOML-based configuration, and runs significantly faster than its predecessor while providing more actionable diagnostics.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Revive Linter
Comando de instalación directa
npx -y tokrepo@latest install 09d9f3af-5ad5-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

Revive is a Go linter built as a faster, more configurable successor to the now-archived golint. It checks Go source code for style violations, naming conventions, and common mistakes, and lets teams define custom rules to enforce project-specific standards.

What Revive Does

  • Enforces Go naming conventions (exported names, package comments, error types)
  • Detects unreachable code, unused parameters, and unnecessary blank identifiers
  • Validates function complexity, argument counts, and return value patterns
  • Supports custom rules written as Go functions loaded at runtime
  • Outputs diagnostics in text, JSON, or friendly formatted styles

Architecture Overview

Revive parses Go source files using the standard go/ast and go/token packages, then runs each file through a pipeline of rule checkers. Rules implement a simple interface receiving an AST file and returning failures. Configuration is loaded from a TOML file that enables, disables, or sets severity and arguments per rule. The runner parallelizes across packages for speed.

Self-Hosting & Configuration

  • Install with go install github.com/mgechev/revive@latest
  • Create a revive.toml to enable or disable specific rules
  • Set rule severity to warning or error to control exit codes
  • Exclude generated files or test files with exclude patterns in config
  • Integrates with golangci-lint as a bundled linter

Key Features

  • Drop-in golint replacement with backward-compatible rule set
  • TOML-based config for per-rule severity, arguments, and exclusions
  • Custom rule API lets teams add project-specific checks
  • Parallel execution across packages for fast analysis of large codebases
  • Multiple output formatters including JSON for CI integration

Comparison with Similar Tools

  • golint — archived and unmaintained; Revive is its actively developed successor
  • Staticcheck — focuses on correctness and bug detection; Revive focuses on style and conventions
  • golangci-lint — meta-linter that can run Revive alongside other tools
  • go vet — catches low-level issues; Revive targets higher-level style and readability
  • gofmt/gofumpt — handle formatting only; Revive addresses semantic style rules

FAQ

Q: Is Revive a drop-in replacement for golint? A: Yes, Revive includes all of golint's rules and adds many more while maintaining backward compatibility.

Q: How do I write a custom rule? A: Implement the revive.Rule interface with a Name() and Apply(*File, Arguments) method, then reference it in your config.

Q: Can I use Revive with golangci-lint? A: Yes, golangci-lint includes Revive as one of its bundled linters with pass-through config support.

Q: How fast is Revive compared to golint? A: Revive runs rules in parallel and is typically several times faster than golint on multi-package projects.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados