aboutsummaryrefslogtreecommitdiff
path: root/imports
diff options
context:
space:
mode:
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>2018-07-10 02:50:39 +0700
committerBrad Fitzpatrick <bradfitz@golang.org>2018-07-10 02:38:27 +0000
commit8cb83b71b42ccf5fe279fa8a24a6a8f65507dc9c (patch)
tree6271177e249dbb2edeb8c35a6a4b1d1f94cf686e /imports
parentd600f31f815368e57b551e524b0169bd175f7edb (diff)
downloadgolang-x-tools-8cb83b71b42ccf5fe279fa8a24a6a8f65507dc9c.tar.gz
imports: fix lost line between package and import statement
Fixes golang/go#26290 Change-Id: Ide797a46bf1d0d6070940fb5b9db3e76502bc528 Reviewed-on: https://go-review.googlesource.com/122736 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'imports')
-rw-r--r--imports/fix_test.go36
1 files changed, 34 insertions, 2 deletions
diff --git a/imports/fix_test.go b/imports/fix_test.go
index f9bac4610..0d413e430 100644
--- a/imports/fix_test.go
+++ b/imports/fix_test.go
@@ -1021,6 +1021,38 @@ func main() {
}
`,
},
+
+ {
+ name: "issue #26290 1",
+ in: `package p // comment
+
+import "math"
+
+var _ = fmt.Printf
+`,
+ out: `package p // comment
+
+import "fmt"
+
+var _ = fmt.Printf
+`,
+ },
+
+ {
+ name: "issue #26290 2",
+ in: `package p
+
+import "math"
+
+var _ = fmt.Printf
+`,
+ out: `package p
+
+import "fmt"
+
+var _ = fmt.Printf
+`,
+ },
}
func TestFixImports(t *testing.T) {
@@ -1800,8 +1832,8 @@ func TestImportPathToNameGoPathParse(t *testing.T) {
func TestIgnoreConfiguration(t *testing.T) {
testConfig{
gopathFiles: map[string]string{
- ".goimportsignore": "# comment line\n\n example.net", // tests comment, blank line, whitespace trimming
- "example.net/pkg/pkg.go": "package pkg\nconst X = 1",
+ ".goimportsignore": "# comment line\n\n example.net", // tests comment, blank line, whitespace trimming
+ "example.net/pkg/pkg.go": "package pkg\nconst X = 1",
"otherwise-longer-so-worse.example.net/foo/pkg/pkg.go": "package pkg\nconst X = 1",
},
}.test(t, func(t *goimportTest) {