Skip to content

Commit 59fe2e4

Browse files
committed
cue/load: clean up allTags
It was a remnant of this refactor and hasn't been used since: https://cue-review.googlesource.com/c/cue/+/7901 Originally (before that CL) the Instance.AllTags field was populated from //+build comments, something that's never been a supported thing in CUE. It seems like it was a remnant of the original Go code this was derived from. Since that CL, the `AllTags` field has always remained empty and never populated. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I2a90c720ff567bd4eed7cec21f7a980654600cd2 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1197523 Reviewed-by: Paul Jolly <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent d5d4815 commit 59fe2e4

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

cue/build/instance.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ type Instance struct {
9797

9898
// AllTags are the build tags that can influence file selection in this
9999
// directory.
100+
//
101+
// Deprecated: this field is not used.
100102
AllTags []string `api:"alpha"`
101103

102104
// Incomplete reports whether any dependencies had an error.

cue/load/loader_common.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ type fileProcessor struct {
102102
firstFile string
103103
firstCommentFile string
104104
imported map[string][]token.Pos
105-
allTags map[string]bool
106105
ignoreOther bool // ignore files from other packages
107106
allPackages bool
108107

@@ -119,7 +118,6 @@ type fileProcessorConfig = Config
119118
func newFileProcessor(c *fileProcessorConfig, p *build.Instance, tg *tagger) *fileProcessor {
120119
return &fileProcessor{
121120
imported: make(map[string][]token.Pos),
122-
allTags: make(map[string]bool),
123121
c: c,
124122
pkgs: map[string]*build.Instance{"_": p},
125123
pkg: p,
@@ -151,11 +149,6 @@ func (fp *fileProcessor) finalize(p *build.Instance) errors.Error {
151149
return fp.err
152150
}
153151

154-
for tag := range fp.allTags {
155-
p.AllTags = append(p.AllTags, tag)
156-
}
157-
sort.Strings(p.AllTags)
158-
159152
p.ImportPaths, _ = cleanImports(fp.imported)
160153

161154
return nil
@@ -187,7 +180,7 @@ func (fp *fileProcessor) add(root string, file *build.File, mode importMode) (ad
187180
return badFile(errors.Promote(err, ""))
188181
}
189182

190-
match, data, err := matchFile(fp.c, file, true, fp.allTags, mode)
183+
match, data, err := matchFile(fp.c, file, true, mode)
191184
switch {
192185
case match:
193186

cue/load/match.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ func (e excludeError) Is(err error) bool { return err == errExclude }
4747
// If returnImports is true and name denotes a CUE file, matchFile reads
4848
// until the end of the imports (and returns that data) even though it only
4949
// considers text until the first non-comment.
50-
// If allTags is non-nil, matchFile records any encountered build tag
51-
// by setting allTags[tag] = true.
52-
func matchFile(cfg *Config, file *build.File, returnImports bool, allTags map[string]bool, mode importMode) (match bool, data []byte, err errors.Error) {
50+
func matchFile(cfg *Config, file *build.File, returnImports bool, mode importMode) (match bool, data []byte, err errors.Error) {
5351
// Note: file.Source should already have been set by setFileSource just
5452
// after the build.File value was created.
5553
if file.Encoding != build.CUE {

0 commit comments

Comments
 (0)