pkgerrors

package module
v0.0.0-...-9bb0936 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

README

go-analyzer/pkgerrors

This analyzer rewrites the github.com/pkg/errors (that has been deprecated) to the fmt.Errorf with %w verb provided after the go1.13.

Installation
go install github.com/zchee/go-analyzer/pkgerrors/cmd/pkgerrors@latest
Usage

Find usages:

pkgerrors ./package/to/fix/

Fix findings:

pkgerrors -fix ./package/to/fix/
Support functions
  • github.com/pkg/errors.As(err error, target interface{}) bool

    • Replace to errors.As(err error, target interface{}) bool
  • github.com/pkg/errors.Cause(err error) error

    • NO
  • github.com/pkg/errors.Errorf(format string, args ...interface{}) error

    • Replace to fmt.Errorf(format string, args ...interface{}) error
  • github.com/pkg/errors.Is(err, target error) bool

    • Replace to errors.Is(err, target error) bool
  • github.com/pkg/errors.New(message string) error

    • Replace to errors.New(message string) error
  • github.com/pkg/errors.Unwrap(err error) error

    • Replace to errors.Unwrap(err error) error
  • github.com/pkg/errors.WithMessage(err error, message string) error

    • ?
  • github.com/pkg/errors.WithMessagef(err error, format string, args ...interface{}) error

    • ?
  • github.com/pkg/errors.WithStack(err error) error

    • ?
  • github.com/pkg/errors.Wrap(err error, message string) error

    • Rewrite to fmt.Errorf("message: %w", err) error
  • github.com/pkg/errors.Wrapf(err error, format string, args ...interface{}) error

    • Rewrite to fmt.Errorf("format: %w", args..., err) error

Documentation

Index

Constants

View Source
const Doc = `` /* 152-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "pkgerrors",
	Doc:  Doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		pkgfact.Analyzer,
		inspect.Analyzer,
	},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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