mirror of
https://github.com/Crocmagnon/fatcontext.git
synced 2024-11-24 17:08:07 +01:00
Compare commits
No commits in common. "632a706303736ba949bf9a549312c643b38a34e8" and "4ad817c8f3cdc840ca4514cbec5aeb72ce59639e" have entirely different histories.
632a706303
...
4ad817c8f3
4 changed files with 7 additions and 16 deletions
|
@ -1,9 +1,3 @@
|
||||||
issues:
|
issues:
|
||||||
exclude-dirs:
|
exclude-dirs:
|
||||||
- contrib
|
- contrib
|
||||||
linters:
|
|
||||||
enable:
|
|
||||||
- goimports
|
|
||||||
linters-settings:
|
|
||||||
goimports:
|
|
||||||
local-prefixes: "github.com/Crocmagnon/fatcontext"
|
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue