Skip to content

Commit

Permalink
cue/load: remove unused code
Browse files Browse the repository at this point in the history
Change-Id: I29d80f4c9be10577ff39fa156f5dbb37cb5ce78b
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9681
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
  • Loading branch information
mpvl committed May 5, 2021
1 parent bcdf277 commit 975ba50
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 104 deletions.
54 changes: 0 additions & 54 deletions cue/load/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"io/ioutil"
"path/filepath"
"strings"
"unicode"

"cuelang.org/go/cue/build"
"cuelang.org/go/cue/errors"
Expand Down Expand Up @@ -82,56 +81,3 @@ func matchFile(cfg *Config, file *build.File, returnImports, allFiles bool, allT
match = true
return
}

// doMatch reports whether the name is one of:
//
// tag (if tag is listed in cfg.Build.BuildTags or cfg.Build.ReleaseTags)
// !tag (if tag is not listed in cfg.Build.BuildTags or cfg.Build.ReleaseTags)
// a comma-separated list of any of these
//
func doMatch(cfg *Config, name string, allTags map[string]bool) bool {
if name == "" {
if allTags != nil {
allTags[name] = true
}
return false
}
if i := strings.Index(name, ","); i >= 0 {
// comma-separated list
ok1 := doMatch(cfg, name[:i], allTags)
ok2 := doMatch(cfg, name[i+1:], allTags)
return ok1 && ok2
}
if strings.HasPrefix(name, "!!") { // bad syntax, reject always
return false
}
if strings.HasPrefix(name, "!") { // negation
return len(name) > 1 && !doMatch(cfg, name[1:], allTags)
}

if allTags != nil {
allTags[name] = true
}

// Tags must be letters, digits, underscores or dots.
// Unlike in CUE identifiers, all digits are fine (e.g., "386").
for _, c := range name {
if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' {
return false
}
}

// other tags
for _, tag := range cfg.BuildTags {
if tag == name {
return true
}
}
for _, tag := range cfg.releaseTags {
if tag == name {
return true
}
}

return false
}
50 changes: 0 additions & 50 deletions cue/load/match_test.go

This file was deleted.

0 comments on commit 975ba50

Please sign in to comment.