Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent eof newline in text export and vet #3557

Open
davireis opened this issue Nov 5, 2024 · 0 comments
Open

Inconsistent eof newline in text export and vet #3557

davireis opened this issue Nov 5, 2024 · 0 comments
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@davireis
Copy link

davireis commented Nov 5, 2024

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

$ cue version
cue version v0.10.0

go version go1.23.0
      -buildmode exe
       -compiler gc
        -ldflags -s -w -X cuelang.org/go/cmd/cue/cmd.version=v0.10.0
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
         GOARM64 v8.0
             vcs git
    vcs.revision a7c37ee1eeb84546552bcc70aa280ab7c748e9e9
        vcs.time 2024-08-14T21:53:19Z
    vcs.modified false
cue.lang.version v0.10.0

Does this issue reproduce with the latest stable release?

Yes.

What did you do?

echo '""' > a.cue
cue export a.cue --out text --outfile out.txt
cue vet a.cue text: out.txt

conflicting values "" and "\n":
    -
    ./a.cue:1:1

What did you expect to see?

I expected that cue would successfully validate the configuration it generated.

What did you see instead?

When cue exports text it adds a newline in the of the file.

hexdump out.txt
0000000 000a
0000001

This is not uncommon for terminal applications. But it breaks the validation flow. Either validation should append the newline such that the config validates, or export should not generate the newline. This only happens for text, for json any config generated by cue can be validated by the same cue file.

@davireis davireis added NeedsInvestigation Triage Requires triage/attention labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

1 participant