Linter for errors.Is and errors.As

Related tags

Error Handling erris
Overview

erris

erris is a program for checking that errors are compared or type asserted using go1.13 errors.Is and errors.As functions.

Build Status Report

Install

go get -u github.com/romanyx/erris/cmd/erris

Use

For basic usage, just give the package path of interest as the first argument:

erris github.com/romanyx/erris/testdata

Outputs:

github.com/romanyx/erris/testdata/main.go:14:5:	use errors.Is to compare an error
github.com/romanyx/erris/testdata/main_test.go:11:14:	use errors.As to type assert an error

To check all packages beneath the current directory:

erris ./...
You might also like...
Hierarchical errors reporting done right in Golang

Hierarchical errors made right Hate seeing error: exit status 128 in the output of programs without actual explanation what is going wrong? Or, maybe,

harvest Go errors with ease

Pears Harvest Go Errors with Ease Introduction Pears helps reduce the boilerplate and ensure correctness for common error-handling scenarios: Panic re

SupErr -- Go stdlib errors with super powers

superr SupErr -- Go stdlib errors with super powers. Pronounced super with a French accent :D Build a stack of errors compatible with Go stdlib and er

Package semerr helps to work with errors in Golang.
Package semerr helps to work with errors in Golang.

semerr Package semerr helps to work with errors in Golang. Const error An error that can be defined as const. var errMutable error = errors.New("mutab

A Nostress Errors Package For Golang

A Nostress Errors Package For Golang

Simple Go library for typed errors creation

go-typed-errors Why this repo was created? Main reason was to create additional methods for better error typing support. Why not to use errors.As and

Simple Go library for typed const errors creation

go-errors Why this repo was created? Main reason was to create additional methods for better error typing support. Features Errors as constants errors

This project is for parsing Artifactory logs for errors

hello-frog About this plugin This plugin is a template and a functioning example for a basic JFrog CLI plugin. This README shows the expected structur

Go package for errors with chained stack traces

errstack: Go errors with chained stack traces errstack is a Go package for creating errors with stack traces. It is heavily inspired by github.com/pkg

Comments
  • repackage as analysis.Analyzer

    repackage as analysis.Analyzer

    To better allow for metalinters and toolchains to integrate with erris, this change exposes an golang.org/x/tools/go/analysis.Analyzer and reorganises things to this end.

    github.com/romanyx/erris/internal/checker has been mostly replaced with logic from golang.org/x/tools/go/analysis. This traditionally lives at the root, and cannot be put under an internal repo, thus has been moved to the root. The remaining vestages live on as erris.run, which reports instead of returns the errors to the analysis.Pass.

    The ignoretests flag is, imo, incompatible with the analysis tooling, thus has been retained, but deprecated, and is now a noop. It can be removed when appropriate.

    github.com/romanyx/erris/internal/visitor has been updated to talk about analysis.Pass not packages.Package. This change was seamless because the only portions of Package that were used are also in Pass.

    Because the root now contains the exposed library interface, the main package has been moved to the canonical cmd directory: github.com/romanyx/erris/cmd/erris. This is a breaking change, thus the documentation has been updated.

    enhancement 
    opened by urandom2 2
Owner
Roman Budnikov
Gopher. Twitter: @romanyx0
Roman Budnikov
Common juju errors and functions to annotate errors. Based on juju/errgo

errors import "github.com/juju/errors" The juju/errors provides an easy way to annotate errors without losing the original error context. The exporte

Juju 1.3k Dec 30, 2022
An errors package optimized for the pkg/errors package

errors An errors package optimized for the pkg/errors package Use Download and install go get github.com/dobyte/errors API // New Wrapping for errors.

Fuxiao 3 Mar 2, 2022
eris provides a better way to handle, trace, and log errors in Go 🎆

eris Package eris provides a better way to handle, trace, and log errors in Go. go get github.com/rotisserie/eris Why you'll want to switch to eris Us

null 1.2k Dec 29, 2022
Golang errors with stack trace and source fragments.

Golang Errors with Stack Trace and Source Fragments Tired of uninformative error output? Probably this will be more convenient: Example package main

null 753 Dec 17, 2022
Go tool to wrap and fix errors with the new %w verb directive

errwrap Wrap and fix Go errors with the new %w verb directive. This tool analyzes fmt.Errorf() calls and reports calls that contain a verb directive t

Fatih Arslan 354 Nov 10, 2022
Golang errors with stacktrace and context

merry Add context to errors, including automatic stack capture, cause chains, HTTP status code, user messages, and arbitrary values. The package is la

Russ Egan 261 Nov 19, 2022
This structured Error package wraps errors with context and other info

RErr package This structured Error package wraps errors with context and other info. It can be used to enrich logging, for example with a structured l

Rohan Allison 0 Jan 21, 2022
The Emperor takes care of all errors personally

The Emperor takes care of all errors personally. Go's philosophy encourages to gracefully handle errors whenever possible, but some times recovering f

Emperror 281 Jan 9, 2023
A drop-in replacement for Go errors, with some added sugar! Unwrap user-friendly messages, HTTP status code, easy wrapping with multiple error types.

Errors Errors package is a drop-in replacement of the built-in Go errors package with no external dependencies. It lets you create errors of 11 differ

Kamaleshwar 47 Dec 6, 2022
A Go (golang) package for representing a list of errors as a single error.

go-multierror go-multierror is a package for Go that provides a mechanism for representing a list of error values as a single error. This allows a fun

HashiCorp 1.8k Jan 1, 2023