Skip to content

Commit 97f326c

Browse files
committed
refactor(goimports): use github.com/rogpeppe/go-internal/diff
1 parent 9cbffe3 commit 97f326c

File tree

3 files changed

+5
-121
lines changed

3 files changed

+5
-121
lines changed

goimports/LICENSE

Lines changed: 0 additions & 27 deletions
This file was deleted.

goimports/goimports.go

Lines changed: 0 additions & 88 deletions
This file was deleted.

goimports/golangci.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package goimports
22

33
import (
44
"bytes"
5-
"fmt"
65
"os"
6+
"path/filepath"
77

8+
"github.com/rogpeppe/go-internal/diff"
89
"golang.org/x/tools/imports"
910
)
1011

@@ -26,10 +27,8 @@ func Run(filename string) ([]byte, error) {
2627
}
2728

2829
// formatting has changed
29-
data, err := diff(src, res, filename)
30-
if err != nil {
31-
return nil, fmt.Errorf("error computing diff: %s", err)
32-
}
30+
newName := filepath.ToSlash(filename)
31+
oldName := newName + ".orig"
3332

34-
return data, nil
33+
return diff.Diff(oldName, src, newName, res), nil
3534
}

0 commit comments

Comments
 (0)