wrapmsg

package module
v0.0.0-...-ac2f74a Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 10 Imported by: 0

README

wrapmsg

Coverage Status

wrapmsg is Go code linter. this enforces fmt.Errorf's message when you wrap error.

Example

// OK 👍🏻
if err := pkg.Cause(); err != nil {
  return fmt.Errorf("pkg.Cause: %w", err)
}

// NG 🙅
if err := pkg.Cause(); err != nil {
  return fmt.Errorf("cause failed: %w", err)
}

Install

go install github.com/Warashi/wrapmsg/cmd/wrapmsg@latest

Usage

You can use wrapmsg as vettool.

go vet -vettool=$(which wrapmsg) ./...

You can also build your linter with singlechecker or multichecker. In this way, you can use --fix option to autocorrect.

package main

import (
	"github.com/Warashi/wrapmsg"
	"golang.org/x/tools/go/analysis/singlechecker"
)

func main() {
	singlechecker.Main(wrapmsg.Analyzer)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "wrapmsg",
	Doc:      doc,
	Run:      run,
	Requires: ssautil.Requires(),
}

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