1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-28 08:49:11 +02:00
revive/testdata/string-format.go
2021-04-18 18:35:30 +02:00

31 lines
726 B
Go

// Test string literal regex checks
package pkg
func stringFormatMethod1(a, b string) {
}
func stringFormatMethod2(a, b string, c struct {
d string
}) {
}
type stringFormatMethods struct{}
func (s stringFormatMethods) Method3(a, b, c string) {
}
func stringFormat() {
stringFormatMethod1("This string is fine", "")
stringFormatMethod1("this string is not capitalized", "") // MATCH /must start with a capital letter/
stringFormatMethod2(s3, "", struct {
d string
}{
d: "This string is capitalized, but ends with a period."}) // MATCH /string literal doesn't match user defined regex /[^\.]$//
s := stringFormatMethods{}
s.Method3("", "", "This string starts with th") // MATCH /must not start with 'th'/
}