Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Feb 20, 2021
1 parent f479a92 commit d3ec33e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions test/testdata/govet/default.go → test/testdata/govet.go
@@ -1,18 +1,18 @@
//args: -Egovet
//config: linters-settings.govet.check-shadowing=true
package govet
package testdata

import (
"fmt"
"io"
"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 {
Expand All @@ -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\\)\\?\\)"
}
14 changes: 0 additions & 14 deletions test/testdata/govet/ifaceassert.go

This file was deleted.

14 changes: 14 additions & 0 deletions 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\\)"
}

0 comments on commit d3ec33e

Please sign in to comment.