Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

cmd/cue(/load): clarify scope of build attributes and tags #1005

Closed
myitcv opened this issue May 25, 2021 · 1 comment
Closed

cmd/cue(/load): clarify scope of build attributes and tags #1005

myitcv opened this issue May 25, 2021 · 1 comment
Labels
NeedsInvestigation Triage Requires triage/attention
Milestone

Comments

@myitcv
Copy link
Contributor

myitcv commented May 25, 2021

What version of CUE are you using (cue version)?

$ cue version
cue version +37bf801b linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

# ./a
exec cue eval ./a
stdout 'name: string'

# ./b
exec cue eval ./b
stdout 'name: string'

# -t prod ./a
exec cue eval -t prod ./a
stdout 'name: "cueckoo"'

# -t prod ./b
exec cue eval -t prod ./b
stdout 'name: "cueckoo"'

# -t name=gopher ./a
exec cue eval -t name=gopher ./a
stdout 'name: "gopher"'

# -t name=gopher ./b
exec cue eval -t name=gopher ./b
stdout 'name: "gopher"'

-- a/a.cue --
package a

name: string @tag(name)
-- a/a2.cue --
@if(prod)

package a

name: string | *"cueckoo"
-- b/b.cue --
package b

import "mod.com/a"

name: a.name
-- cue.mod/module.cue --
module: "mod.com"

This behaves as expected. However, it's not clear this should be the behaviour from the docs at cue help injection.

What did you expect to see?

The docs for cue help injection are not clear on precisely what the expectation here should be. My intuition is that those docs should clarify that build attribute constraints apply to all packages during evaluation (a la Go build constraints), whereas tag attributes only apply to named package instances.

What did you see instead?

Potential confusion given the docs are incomplete on this question.

@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#1005.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

@cueckoo cueckoo closed this as completed Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

2 participants