Skip to content

Commit

Permalink
Enable better integration with other tools (#5)
Browse files Browse the repository at this point in the history
* Enable better integration with other tools

Mainly for golangci-lint, which is the default tool.

Related to #2.
  • Loading branch information
ferhatelmas authored and fatih committed Jan 13, 2020
1 parent eb89fa6 commit 201e305
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ different than the new `%w` verb directive [introduced in Go v1.13](https://gola
## Install

```bash
go get github.com/fatih/errwrap/cmd/errwrap
go get github.com/fatih/errwrap
```

## Usage
Expand Down
2 changes: 2 additions & 0 deletions internal/errwrap/errwrap.go → errwrap/errwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"golang.org/x/tools/go/types/typeutil"
)

// Analyzer of the linter
var Analyzer = &analysis.Analyzer{
Name: "errwrap",
Doc: "wrap errors in fmt.Errorf() calls with the %w verb directive",
Expand All @@ -28,6 +29,7 @@ var Analyzer = &analysis.Analyzer{
RunDespiteErrors: true,
}

// Run is the runner for an analysis pass
func run(pass *analysis.Pass) (interface{}, error) {
inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package errwrap_test
import (
"testing"

"github.com/fatih/errwrap/internal/errwrap"
"github.com/fatih/errwrap/errwrap"
"golang.org/x/tools/go/analysis/analysistest"
)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/errwrap/main.go → main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/fatih/errwrap/internal/errwrap"
"github.com/fatih/errwrap/errwrap"
"golang.org/x/tools/go/analysis/singlechecker"
)

Expand Down

0 comments on commit 201e305

Please sign in to comment.