-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43f93ee
commit adcadef
Showing
15 changed files
with
449 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
pkg/analyzer/testdata/var/src/mixed-named-with-consts/testcase.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package testcase | ||
|
||
var ( | ||
a = "a" | ||
b = "b" | ||
|
||
_ = "underscore1" | ||
) | ||
|
||
var ( // want "should only use a single global 'var' declaration, 5 found" | ||
comment1 = "comment1" // some comment | ||
) | ||
|
||
const ignoreconst1 = "ignoreconst1" | ||
const ( | ||
ignoreconst2 = "ignoreconst2" | ||
ignoreconst3 = "ignoreconst3" | ||
) | ||
|
||
func dummy() { | ||
var ( | ||
ignorea = "ignorea" | ||
ignoreb = "ignoreb" | ||
|
||
_ = "ignoreunderscore1" | ||
) | ||
|
||
var ( | ||
ignorecomment1 = "ignorecomment1" // some comment | ||
) | ||
|
||
var ignorec = "ignorec" | ||
var _ = "ignoreunderscore2" | ||
|
||
var () | ||
|
||
_ = a | ||
_ = b | ||
_ = c | ||
_ = comment1 | ||
_ = comment2 | ||
_ = ignorecomment1 | ||
_ = ignorea | ||
_ = ignoreb | ||
_ = ignorec | ||
} | ||
|
||
var c = "c" // want "should only use grouped global 'var' declarations" | ||
|
||
var comment2 = "comment2" // some comment | ||
|
||
var () |
55 changes: 55 additions & 0 deletions
55
pkg/analyzer/testdata/var/src/mixed-named-with-var-shorthand/testcase.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package testcase | ||
|
||
var ( | ||
a = "a" | ||
b = "b" | ||
|
||
_ = "underscore1" | ||
) | ||
|
||
var ( // want "should only use a single global 'var' declaration, 5 found" | ||
comment1 = "comment1" // some comment | ||
) | ||
|
||
const ignoreconst1 = "ignoreconst1" | ||
const ( | ||
ignoreconst2 = "ignoreconst2" | ||
ignoreconst3 = "ignoreconst3" | ||
) | ||
|
||
func dummy() { | ||
var ( | ||
ignorea = "ignorea" | ||
ignoreb = "ignoreb" | ||
|
||
_ = "ignoreunderscore1" | ||
) | ||
|
||
var ( | ||
ignorecomment1 = "ignorecomment1" // some comment | ||
) | ||
|
||
var ignorec = "ignorec" | ||
var _ = "ignoreunderscore2" | ||
|
||
var () | ||
|
||
_ = a | ||
_ = b | ||
_ = c | ||
_ = comment1 | ||
_ = comment2 | ||
_ = ignorecomment1 | ||
_ = ignorea | ||
_ = ignoreb | ||
_ = ignorec | ||
|
||
hello := "world" | ||
println(hello) | ||
} | ||
|
||
var c = "c" // want "should only use grouped global 'var' declarations" | ||
|
||
var comment2 = "comment2" // some comment | ||
|
||
var () |
37 changes: 37 additions & 0 deletions
37
pkg/analyzer/testdata/var/src/mixed-require-grouping/testcase.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package testcase | ||
|
||
var ( | ||
a = "a" | ||
b = "b" | ||
|
||
_ = "underscore1" | ||
) | ||
|
||
var ( | ||
comment1 = "comment1" // some comment | ||
) | ||
|
||
var c = "c" // want "should only use grouped global 'var' declarations" | ||
|
||
var comment2 = "comment2" // some comment | ||
|
||
var () | ||
|
||
func dummy() { | ||
var ( | ||
_ = "ignore1" | ||
_ = "ignore2" | ||
) | ||
|
||
var ( | ||
_ = "ignore3" | ||
) | ||
|
||
var d = "d" | ||
var comment3 = "comment3" // some comment | ||
|
||
println(d) | ||
println(comment3) | ||
|
||
var () | ||
} |
37 changes: 37 additions & 0 deletions
37
pkg/analyzer/testdata/var/src/mixed-require-single-var/testcase.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package testcase | ||
|
||
var ( | ||
a = "a" | ||
b = "b" | ||
|
||
_ = "underscore1" | ||
) | ||
|
||
var ( // want "should only use a single global 'var' declaration, 5 found" | ||
comment1 = "comment1" // some comment | ||
) | ||
|
||
var c = "c" | ||
|
||
var comment2 = "comment2" // some comment | ||
|
||
var () | ||
|
||
func dummy() { | ||
var ( | ||
_ = "ignore1" | ||
_ = "ignore2" | ||
) | ||
|
||
var ( | ||
_ = "ignore3" | ||
) | ||
|
||
var d = "d" | ||
var comment3 = "comment3" // some comment | ||
|
||
println(d) | ||
println(comment3) | ||
|
||
var () | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package testcase | ||
|
||
var ( | ||
a = "a" | ||
b = "b" | ||
|
||
_ = "underscore1" | ||
) | ||
|
||
func dummy() { | ||
var ( | ||
_ = "ignore1" | ||
_ = "ignore2" | ||
) | ||
} |
Oops, something went wrong.