Skip to content

Commit

Permalink
lint: 💄
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Dec 5, 2024
1 parent 942e893 commit ccfaff1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
12 changes: 5 additions & 7 deletions example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ type writer interface {
}

func writeToWriter(w writer) {
w.Write([]string{"userId", "secret", "comment"})
w.Write([]string{"-21+63", "=A1", "foo, bar"})
w.Write([]string{"+42", "\tsecret", "\nplop"})
w.Write([]string{"123", "blablabla", "@foobar"})
must(w.Write([]string{"userId", "secret", "comment"}))
must(w.Write([]string{"-21+63", "=A1", "foo, bar"}))
must(w.Write([]string{"+42", "\tsecret", "\nplop"}))
must(w.Write([]string{"123", "blablabla", "@foobar"}))
w.Flush()
if err := w.Error(); err != nil {
panic(err)
}
must(w.Error())
}

func unsafe() string {
Expand Down
7 changes: 7 additions & 0 deletions example/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

func must(err error) {
if err != nil {
panic(err)
}
}
18 changes: 11 additions & 7 deletions writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import (
"github.com/stretchr/testify/assert"
)

func must(err error) {
if err != nil {
panic(err)
}
}

func buildTest(forceDoubleQuotes bool, escapeCharEqual bool, escapeCharPlus bool, escapeCharMinus bool, escapeCharAt bool, escapeCharTab bool, escapeCharCR bool) string {
var buff strings.Builder

Expand All @@ -22,14 +28,12 @@ func buildTest(forceDoubleQuotes bool, escapeCharEqual bool, escapeCharPlus bool
EscapeCharCR: escapeCharCR,
},
)
writer.Write([]string{"userId", "secret", "comment"})
writer.Write([]string{"-21+63", "=A1", "foo, bar"})
writer.Write([]string{"+42", "\tsecret", "\nplop"})
writer.Write([]string{"123", "blablabla", "@foobar"})
must(writer.Write([]string{"userId", "secret", "comment"}))
must(writer.Write([]string{"-21+63", "=A1", "foo, bar"}))
must(writer.Write([]string{"+42", "\tsecret", "\nplop"}))
must(writer.Write([]string{"123", "blablabla", "@foobar"}))
writer.Flush()
if err := writer.Error(); err != nil {
panic(err)
}
must(writer.Error())

return buff.String()
}
Expand Down

0 comments on commit ccfaff1

Please sign in to comment.