gorules

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package gorules contains ruleguard linter rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreferXerrors added in v0.50.0

func PreferXerrors(m dsl.Matcher)

PreferXerrors suggests replace expressions like

errors.As

to

xerrors.As

func UberStyleErrors added in v0.50.0

func UberStyleErrors(m dsl.Matcher)

UberStyleErrors detects error messages like

xerrors.Errorf("failed to do something: %w", err)

but you should avoid "failed to" and use

xerrors.Errorf("do something: %w", err)

according to https://github.com/uber-go/guide/blob/master/style.md#error-wrapping.

func UnnecessaryErrorFormat added in v0.50.0

func UnnecessaryErrorFormat(m dsl.Matcher)

UnnecessaryErrorFormat detects unnecessary error formatting like

xerrors.Errorf("error")

and suggests instead

xerrors.New("error")

func ZapPreferNoWith

func ZapPreferNoWith(m dsl.Matcher)

ZapPreferNoWith suggests replace expressions like

l.With(...).Debug("")

to

l.Debug("", ...).

where l is a *zap.Logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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