altimports

module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT

README

altimports

Find imports that should be replaced by alternative versions.

Motivation

There are many third-part libraries that are drop-in replacements for built-in imports. Some examples:

  • "github.com/pkg/errors" -> "errors"
  • log "github.com/sirupsen/logrus" -> "log"

This linter allows for a configurable input of the replacements you would like and allows enforcement of them via CI.

Get Started

go get github.com/kpurdon/altimports/cmd/altimports
altimports --replacement "errors:github.com/pkg/errors" ./...

The --replacement flag can be specified multiple times and is of the form {import_to_replace}:{import_to_use}. The flag can be specified 1 to many times to specify multiple replacements.

Integrations

Directories

Path Synopsis
cmd
pkg
analyzer
Package analyzer provides a go/analysis Analyzed and Run method.
Package analyzer provides a go/analysis Analyzed and Run method.

Jump to

Keyboard shortcuts

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