mirror of
https://github.com/Crocmagnon/fatcontext.git
synced 2024-11-21 15:38:08 +01:00
Compare commits
2 commits
4ad817c8f3
...
632a706303
Author | SHA1 | Date | |
---|---|---|---|
|
632a706303 | ||
|
98578576b8 |
4 changed files with 16 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
issues:
|
||||
exclude-dirs:
|
||||
- contrib
|
||||
linters:
|
||||
enable:
|
||||
- goimports
|
||||
linters-settings:
|
||||
goimports:
|
||||
local-prefixes: "github.com/Crocmagnon/fatcontext"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/Crocmagnon/fatcontext/pkg/analyzer"
|
||||
"golang.org/x/tools/go/analysis/singlechecker"
|
||||
|
||||
"github.com/Crocmagnon/fatcontext/pkg/analyzer"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -59,7 +59,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
|
|||
{
|
||||
Pos: assignStmt.Pos(),
|
||||
End: assignStmt.End(),
|
||||
NewText: []byte(suggested),
|
||||
NewText: suggested,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -215,10 +215,10 @@ func getRootIdent(pass *analysis.Pass, node ast.Node) *ast.Ident {
|
|||
}
|
||||
|
||||
// render returns the pretty-print of the given node
|
||||
func render(fset *token.FileSet, x interface{}) (string, error) {
|
||||
func render(fset *token.FileSet, x interface{}) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
if err := printer.Fprint(&buf, fset, x); err != nil {
|
||||
return "", fmt.Errorf("printing node: %w", err)
|
||||
return nil, fmt.Errorf("printing node: %w", err)
|
||||
}
|
||||
return buf.String(), nil
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package analyzer_test
|
||||
|
||||
import (
|
||||
"github.com/Crocmagnon/fatcontext/pkg/analyzer"
|
||||
"golang.org/x/tools/go/analysis/analysistest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/tools/go/analysis/analysistest"
|
||||
|
||||
"github.com/Crocmagnon/fatcontext/pkg/analyzer"
|
||||
)
|
||||
|
||||
func TestAll(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue