Skip to content

Commit

Permalink
pkg/path: add missing param declaration
Browse files Browse the repository at this point in the history
The standard library function path.Match requires 3 parameters, but only
2 are currently declared. This causes valid usage of the function to
fail with the following error:

    too many arguments in call to path.Match (have 3, want 2):

To fix this, the missing parameter declaration is added.

Fixes #3203.

Signed-off-by: Noam Dolovich <noam.tzvi.dolovich@gmail.com>
Change-Id: I6e645293f8e589ad1834e3c33ff7bffc2abb5aed
  • Loading branch information
NoamTD committed Jun 6, 2024
1 parent 889da91 commit 2c23f53
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/path/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ var p = &pkg.Package{
}, {
Name: "Match",
Params: []pkg.Param{
{Kind: adt.StringKind},
{Kind: adt.StringKind},
{Kind: adt.StringKind, Value: unixDefault},
},
Expand Down
42 changes: 42 additions & 0 deletions pkg/path/testdata/os.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ Clean: [_]: {
#"c:\abc\def\..\.."#: _
}

Match: [OS=#AnyOS]: [Pattern=string]: [Name=string]: path.Match(Pattern, Name, OS)
Match: [_]: {
"*c": "abc": _
"*.txt": "a/b.txt": _
"*.zip": #"c:\a\b\file.zip"#: _
}

Slash: [OS=string]: [ARG=string]: {
to: path.ToSlash(ARG, OS)
from: path.FromSlash(ARG, OS)
Expand Down Expand Up @@ -214,6 +221,41 @@ Clean: {
"c:\\abc\\def\\..\\..": "c:\\"
}
}
Match: {
unix: {
"*c": {
abc: true
}
"*.txt": {
"a/b.txt": false
}
"*.zip": {
"c:\\a\\b\\file.zip": true
}
}
plan9: {
"*c": {
abc: true
}
"*.txt": {
"a/b.txt": false
}
"*.zip": {
"c:\\a\\b\\file.zip": true
}
}
windows: {
"*c": {
abc: true
}
"*.txt": {
"a/b.txt": true
}
"*.zip": {
"c:\\a\\b\\file.zip": false
}
}
}
Slash: {
unix: {
"": {
Expand Down

0 comments on commit 2c23f53

Please sign in to comment.