Skip to content

Warashi/wrapmsg

Folders and files

NameName
Last commit message
Last commit date
Jun 9, 2024
Feb 13, 2022
Nov 16, 2024
Feb 17, 2022
Feb 16, 2022
Mar 14, 2022
Nov 9, 2022
Mar 19, 2025
Mar 19, 2025
Apr 27, 2023
Dec 15, 2023
Apr 27, 2023
Feb 13, 2022

Repository files navigation

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)
}

About

Linter for Go's fmt.Errorf message

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages