aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-linter/testdata
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-07-04 14:13:41 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-04 15:05:30 +0200
commit24d7f50531c565743dc0050d5b56b96eb79c0766 (patch)
tree8874e39bd78d26a64e29068c19d6dd62580483e8 /tools/syz-linter/testdata
parent813f363bff69acc436b3c300a2f699f643a644f8 (diff)
tools/syz-linter: add check for dup types in func args
Add check for: func foo(a int, b int) -> func foo(a, b int) Update #1876
Diffstat (limited to 'tools/syz-linter/testdata')
-rw-r--r--tools/syz-linter/testdata/src/lintertest/lintertest.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/tools/syz-linter/testdata/src/lintertest/lintertest.go b/tools/syz-linter/testdata/src/lintertest/lintertest.go
index 2c70a97e8..69b956e80 100644
--- a/tools/syz-linter/testdata/src/lintertest/lintertest.go
+++ b/tools/syz-linter/testdata/src/lintertest/lintertest.go
@@ -23,8 +23,22 @@ func returnString() string { return "foo" }
// Two spaces.
// One tab.
// Two tabs.
-//No space. // want "Use either //<one-or-more-spaces>comment or //<one-or-more-tabs>comment format for comments"
-// Tab and spaces. // want "Use either //<one-or-more-spaces>comment or //<one-or-more-tabs>comment format for comments"
-// Space and tab. // want "Use either //<one-or-more-spaces>comment or //<one-or-more-tabs>comment format for comments"
+//No space. // want "Use either //<one-or-more-spaces>comment or //<one-or-more-tabs>comment format for comments"
+// Tab and spaces. // want "Use either //<one-or-more-spaces>comment or //<one-or-more-tabs>comment format for comments"
+// Space and tab. // want "Use either //<one-or-more-spaces>comment or //<one-or-more-tabs>comment format for comments"
func checkCommentSpace() {
}
+
+func funcArgsGood(a, b int) (int, int) {
+ return 0, 0
+}
+
+func funcArgsBad0(a int, b int) { // want "Use 'a, b int'"
+}
+
+func funcArgsBad1() (a int, b int) { // want "Use 'a, b int'"
+ return 0, 0
+}
+
+func funcArgsBad2(a int16, b, c uint32, d uint32, e int16) { // want "Use 'b, c, d uint32'"
+}