Skip to content

Commit

Permalink
feat: rename resourcename.Matches to resourcename.Match
Browse files Browse the repository at this point in the history
For parity with regexp.Match, also reorderes the arguments to put the
pattern first.

BREAKING CHANGE: Changed name and signature for parity with
regexp.Match.
  • Loading branch information
odsod committed Feb 21, 2021
1 parent 8f01a05 commit 838de65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions resourcename/matches.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package resourcename

// Matches reports whether the specified resource name matches the specified resource name pattern.
func Matches(name, pattern string) bool {
// Match reports whether the specified resource name matches the specified resource name pattern.
func Match(pattern, name string) bool {
var nameScanner, patternScanner Scanner
nameScanner.Init(name)
patternScanner.Init(pattern)
Expand Down
2 changes: 1 addition & 1 deletion resourcename/matches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestMatches(t *testing.T) {
tt := tt
t.Run(tt.test, func(t *testing.T) {
t.Parallel()
assert.Assert(t, Matches(tt.name, tt.pattern) == tt.expected)
assert.Assert(t, Match(tt.pattern, tt.name) == tt.expected)
})
}
}

0 comments on commit 838de65

Please sign in to comment.