Compare commits

..

No commits in common. "632a706303736ba949bf9a549312c643b38a34e8" and "4ad817c8f3cdc840ca4514cbec5aeb72ce59639e" have entirely different histories.

4 changed files with 7 additions and 16 deletions

View file

@ -1,9 +1,3 @@
issues: issues:
exclude-dirs: exclude-dirs:
- contrib - contrib
linters:
enable:
- goimports
linters-settings:
goimports:
local-prefixes: "github.com/Crocmagnon/fatcontext"

View file

@ -1,9 +1,8 @@
package main package main
import ( import (
"golang.org/x/tools/go/analysis/singlechecker"
"github.com/Crocmagnon/fatcontext/pkg/analyzer" "github.com/Crocmagnon/fatcontext/pkg/analyzer"
"golang.org/x/tools/go/analysis/singlechecker"
) )
func main() { func main() {

View file

@ -59,7 +59,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
{ {
Pos: assignStmt.Pos(), Pos: assignStmt.Pos(),
End: assignStmt.End(), End: assignStmt.End(),
NewText: suggested, NewText: []byte(suggested),
}, },
}, },
}) })
@ -215,10 +215,10 @@ func getRootIdent(pass *analysis.Pass, node ast.Node) *ast.Ident {
} }
// render returns the pretty-print of the given node // render returns the pretty-print of the given node
func render(fset *token.FileSet, x interface{}) ([]byte, error) { func render(fset *token.FileSet, x interface{}) (string, error) {
var buf bytes.Buffer var buf bytes.Buffer
if err := printer.Fprint(&buf, fset, x); err != nil { if err := printer.Fprint(&buf, fset, x); err != nil {
return nil, fmt.Errorf("printing node: %w", err) return "", fmt.Errorf("printing node: %w", err)
} }
return buf.Bytes(), nil return buf.String(), nil
} }

View file

@ -1,13 +1,11 @@
package analyzer_test package analyzer_test
import ( import (
"github.com/Crocmagnon/fatcontext/pkg/analyzer"
"golang.org/x/tools/go/analysis/analysistest"
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
"golang.org/x/tools/go/analysis/analysistest"
"github.com/Crocmagnon/fatcontext/pkg/analyzer"
) )
func TestAll(t *testing.T) { func TestAll(t *testing.T) {