Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
5361712a
Commit
5361712a
authored
Mar 13, 2012
by
Maxim Pimenov
Committed by
Russ Cox
Mar 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/build: fix match
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/5801043
parent
cc99d8ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
src/pkg/go/build/build.go
src/pkg/go/build/build.go
+3
-3
src/pkg/go/build/build_test.go
src/pkg/go/build/build_test.go
+1
-0
No files found.
src/pkg/go/build/build.go
View file @
5361712a
...
...
@@ -874,7 +874,7 @@ func splitQuoted(s string) (r []string, err error) {
// !cgo (if cgo is disabled)
// tag (if tag is listed in ctxt.BuildTags)
// !tag (if tag is not listed in ctxt.BuildTags)
// a
slash
-separated list of any of these
// a
comma
-separated list of any of these
//
func
(
ctxt
*
Context
)
match
(
name
string
)
bool
{
if
name
==
""
{
...
...
@@ -888,11 +888,11 @@ func (ctxt *Context) match(name string) bool {
return
false
}
if
strings
.
HasPrefix
(
name
,
"!"
)
{
// negation
return
!
ctxt
.
match
(
name
[
1
:
])
return
len
(
name
)
>
1
&&
!
ctxt
.
match
(
name
[
1
:
])
}
// Tags must be letters, digits, underscores.
// Unlike in Go identifiers, all digits
is
fine (e.g., "386").
// Unlike in Go identifiers, all digits
are
fine (e.g., "386").
for
_
,
c
:=
range
name
{
if
!
unicode
.
IsLetter
(
c
)
&&
!
unicode
.
IsDigit
(
c
)
&&
c
!=
'_'
{
return
false
...
...
src/pkg/go/build/build_test.go
View file @
5361712a
...
...
@@ -36,6 +36,7 @@ func TestMatch(t *testing.T) {
nomatch
(
runtime
.
GOOS
+
","
+
runtime
.
GOARCH
+
",!foo"
)
match
(
runtime
.
GOOS
+
","
+
runtime
.
GOARCH
+
",!bar"
)
nomatch
(
runtime
.
GOOS
+
","
+
runtime
.
GOARCH
+
",bar"
)
nomatch
(
"!"
)
}
func
TestDotSlashImport
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment