errmescheck

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

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 5 Imported by: 0

README

errmesscheck

Go linter that checks error message format.

supported package: https://github.com/pkg/errors

Motivation

We want to unify the format of error messages.

OK pattern🕺

failed to xxxxxxx.

NG pattern👮🏻

xxxxxxx failed.

Usage

package a

import (
	"strconv"

	"github.com/pkg/errors"
)

func Sample() error {
	if _, err := strconv.Atoi("1"); err != nil {
		return errors.Wrap(err, "failed to strconv.Atoi")
	}

	return nil
}

Analysis

$ errorsmescheck ./...
./a.go:11:10: The prefix of the error message should be 'failed to ...'

Installation

go install github.com/sho-hata/errmescheck/cmd/errmescheck@latest

Contribution

  1. Fork (https://github.com/sho-hata/errmescheck/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create new Pull Request

License

MIT

Author

sho-hata

Documentation

Index

Constants

This section is empty.

Variables

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

Analyzer is ...

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