From d3ec33e7a14fa30f18aaa7cc74e5f667047356b2 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 18 Feb 2021 01:36:08 +0100 Subject: [PATCH] fix: tests --- test/testdata/{govet/default.go => govet.go} | 16 ++++++++-------- test/testdata/govet/ifaceassert.go | 14 -------------- test/testdata/govet_ifaceassert.go | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 22 deletions(-) rename test/testdata/{govet/default.go => govet.go} (75%) delete mode 100644 test/testdata/govet/ifaceassert.go create mode 100644 test/testdata/govet_ifaceassert.go diff --git a/test/testdata/govet/default.go b/test/testdata/govet.go similarity index 75% rename from test/testdata/govet/default.go rename to test/testdata/govet.go index f23df4ab1640..b97980352046 100644 --- a/test/testdata/govet/default.go +++ b/test/testdata/govet.go @@ -1,6 +1,6 @@ //args: -Egovet //config: linters-settings.govet.check-shadowing=true -package govet +package testdata import ( "fmt" @@ -8,11 +8,11 @@ import ( "os" ) -func Composites() error { +func GovetComposites() error { return &os.PathError{"first", "path", os.ErrNotExist} // ERROR "composites: \\`(os|io/fs)\\.PathError\\` composite literal uses unkeyed fields" } -func Shadow(f io.Reader, buf []byte) (err error) { +func GovetShadow(f io.Reader, buf []byte) (err error) { if f != nil { _, err := f.Read(buf) // ERROR `shadow: declaration of .err. shadows declaration at line \d+` if err != nil { @@ -24,20 +24,20 @@ func Shadow(f io.Reader, buf []byte) (err error) { return } -func NolintVet() error { +func GovetNolintVet() error { return &os.PathError{"first", "path", os.ErrNotExist} //nolint:vet } -func NolintVetShadow() error { +func GovetNolintVetShadow() error { return &os.PathError{"first", "path", os.ErrNotExist} //nolint:vetshadow } -func Printf() { +func GovetPrintf() { x := "dummy" fmt.Printf("%d", x) // ERROR "printf: Printf format %d has arg x of wrong type string" } -func StringIntConv() { +func GovetStringIntConv() { i := 42 - fmt.Println("i = " + string(i)) // ERROR "stringintconv: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)" + fmt.Println("i = " + string(i)) // ERROR "stringintconv: conversion from int to string yields a string of one rune, not a string of digits \\(did you mean fmt.Sprint\\(x\\)\\?\\)" } diff --git a/test/testdata/govet/ifaceassert.go b/test/testdata/govet/ifaceassert.go deleted file mode 100644 index c00535c226e8..000000000000 --- a/test/testdata/govet/ifaceassert.go +++ /dev/null @@ -1,14 +0,0 @@ -//args: -Egovet -//config: linters-settings.govet.enable=["ifaceassert"] -package govet - -import ( - "io" -) - -func IfaceAssert() { - var v interface { - Read() - } - _ = v.(io.Reader) // ERROR "composites: `os.PathError` composite literal uses unkeyed fields" -} diff --git a/test/testdata/govet_ifaceassert.go b/test/testdata/govet_ifaceassert.go new file mode 100644 index 000000000000..9a4253aa0465 --- /dev/null +++ b/test/testdata/govet_ifaceassert.go @@ -0,0 +1,14 @@ +//args: -Egovet +//config: linters-settings.govet.enable=ifaceassert +package testdata + +import ( + "io" +) + +func GovetIfaceAssert() { + var v interface { + Read() + } + _ = v.(io.Reader) // ERROR "impossible type assertion: no type can implement both interface\\{Read\\(\\)\\} and io\\.Reader \\(conflicting types for Read method\\)" +}