Skip to content

Commit

Permalink
fix: add missing Fprint
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jul 16, 2022
1 parent 67b1913 commit e8ab024
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 1 deletion.
2 changes: 1 addition & 1 deletion asasalint.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const BuiltinExclude = "Print,Printf,Println," +
"Fprintf,Fprintln," +
"Fprint,Fprintf,Fprintln," +
"Sprint,Sprintf,Sprintln," +
"Fatal,Fatalf,Fatalln," +
"Panic,Panicf,Panicln," +
Expand Down
10 changes: 10 additions & 0 deletions testdata/src/basic/std.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"io"
"log"
)

Expand All @@ -12,6 +13,15 @@ func std() {
fmt.Printf("%v", a)
fmt.Print(a)

fmt.Sprintln(a)
fmt.Sprintf("%v", a)
fmt.Sprint(a)

var w io.Writer
fmt.Fprintln(w, a)
fmt.Fprintf(w, "%v", a)
fmt.Fprint(w, a)

log.Println(a)
log.Printf("%v", a)
log.Print(a)
Expand Down
10 changes: 10 additions & 0 deletions testdata/src/basic/std_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"io"
"log"
"testing"
)
Expand All @@ -13,6 +14,15 @@ func TestStd(t *testing.T) {
fmt.Printf("%v", a)
fmt.Print(a)

fmt.Sprintln(a)
fmt.Sprintf("%v", a)
fmt.Sprint(a)

var w io.Writer
fmt.Fprintln(w, a)
fmt.Fprintf(w, "%v", a)
fmt.Fprint(w, a)

log.Println(a)
log.Printf("%v", a)
log.Print(a)
Expand Down
10 changes: 10 additions & 0 deletions testdata/src/ignoretest/std.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"io"
"log"
)

Expand All @@ -12,6 +13,15 @@ func std() {
fmt.Printf("%v", a)
fmt.Print(a)

fmt.Sprintln(a)
fmt.Sprintf("%v", a)
fmt.Sprint(a)

var w io.Writer
fmt.Fprintln(w, a)
fmt.Fprintf(w, "%v", a)
fmt.Fprint(w, a)

log.Println(a)
log.Printf("%v", a)
log.Print(a)
Expand Down
10 changes: 10 additions & 0 deletions testdata/src/ignoretest/std_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"io"
"log"
"testing"
)
Expand All @@ -13,6 +14,15 @@ func TestStd(t *testing.T) {
fmt.Printf("%v", a)
fmt.Print(a)

fmt.Sprintln(a)
fmt.Sprintf("%v", a)
fmt.Sprint(a)

var w io.Writer
fmt.Fprintln(w, a)
fmt.Fprintf(w, "%v", a)
fmt.Fprint(w, a)

log.Println(a)
log.Printf("%v", a)
log.Print(a)
Expand Down
10 changes: 10 additions & 0 deletions testdata/src/nobuiltin/std.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"io"
"log"
)

Expand All @@ -12,6 +13,15 @@ func std() {
fmt.Printf("%v", a) // want `pass \[\]any as any to func Printf func\(format string, a \.\.\.any\) \(n int, err error\)`
fmt.Print(a) // want `pass \[\]any as any to func Print func\(a \.\.\.any\) \(n int, err error\)`

fmt.Sprintln(a) // want `pass \[\]any as any to func Sprintln func\(a \.\.\.any\) string`
fmt.Sprintf("%v", a) // want `pass \[\]any as any to func Sprintf func\(format string, a \.\.\.any\) string`
fmt.Sprint(a) // want `pass \[\]any as any to func Sprint func\(a \.\.\.any\) string`

var w io.Writer
fmt.Fprintln(w, a) // want `pass \[\]any as any to func Fprintln func\(w io.Writer, a \.\.\.any\) \(n int, err error\)`
fmt.Fprintf(w, "%v", a) // want `pass \[\]any as any to func Fprintf func\(w io.Writer, format string, a \.\.\.any\) \(n int, err error\)`
fmt.Fprint(w, a) // want `pass \[\]any as any to func Fprint func\(w io.Writer, a \.\.\.any\) \(n int, err error\)`

log.Println(a) // want `pass \[\]any as any to func Println func\(v \.\.\.any\)`
log.Printf("%v", a) // want `pass \[\]any as any to func Printf func\(format string, v \.\.\.any\)`
log.Print(a) // want `pass \[\]any as any to func Print func\(v \.\.\.any\)`
Expand Down
10 changes: 10 additions & 0 deletions testdata/src/nobuiltin/std_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"io"
"log"
"testing"
)
Expand All @@ -13,6 +14,15 @@ func TestStd(t *testing.T) {
fmt.Printf("%v", a) // want `pass \[\]any as any to func Printf func\(format string, a \.\.\.any\) \(n int, err error\)`
fmt.Print(a) // want `pass \[\]any as any to func Print func\(a \.\.\.any\) \(n int, err error\)`

fmt.Sprintln(a) // want `pass \[\]any as any to func Sprintln func\(a \.\.\.any\) string`
fmt.Sprintf("%v", a) // want `pass \[\]any as any to func Sprintf func\(format string, a \.\.\.any\) string`
fmt.Sprint(a) // want `pass \[\]any as any to func Sprint func\(a \.\.\.any\) string`

var w io.Writer
fmt.Fprintln(w, a) // want `pass \[\]any as any to func Fprintln func\(w io.Writer, a \.\.\.any\) \(n int, err error\)`
fmt.Fprintf(w, "%v", a) // want `pass \[\]any as any to func Fprintf func\(w io.Writer, format string, a \.\.\.any\) \(n int, err error\)`
fmt.Fprint(w, a) // want `pass \[\]any as any to func Fprint func\(w io.Writer, a \.\.\.any\) \(n int, err error\)`

log.Println(a) // want `pass \[\]any as any to func Println func\(v \.\.\.any\)`
log.Printf("%v", a) // want `pass \[\]any as any to func Printf func\(format string, v \.\.\.any\)`
log.Print(a) // want `pass \[\]any as any to func Print func\(v \.\.\.any\)`
Expand Down

0 comments on commit e8ab024

Please sign in to comment.