Skip to content

encoding/toml: Import fails with unknown DateTime error #3345

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

Closed
qjcg opened this issue Jul 30, 2024 · 1 comment
Closed

encoding/toml: Import fails with unknown DateTime error #3345

qjcg opened this issue Jul 30, 2024 · 1 comment

Comments

@qjcg
Copy link

qjcg commented Jul 30, 2024

I tried cue import with the basic TOML example from the landing page of the official TOML website, and it failed with an unknown Datetime error (details below).

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

$ cue version
cue version v0.10.0-alpha.2.0.20240730115453-9b91188ea551

go version go1.22.5
      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.10.0

Does this issue reproduce with the latest stable release?

N/A

What did you do?

exec cue import example.toml

-- example.toml --
# This is a TOML document

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00

[database]
enabled = true
ports = [ 8000, 8001, 8002 ]
data = [ ["delta", "phi"], [3.14] ]
temp_targets = { cpu = 79.5, case = 72.0 }

[servers]

[servers.alpha]
ip = "10.0.0.1"
role = "frontend"

[servers.beta]
ip = "10.0.0.2"
role = "backend"

What did you expect to see?

No error, an example.cue successfully created via the cue import command.

What did you see instead?

$ testscript test_toml_import.txtar 
> exec cue import example.toml
[stderr]
encoding/toml.Decoder.decodeExpr: unknown DateTime &unstable.Node{Kind:15, Raw:unstable.Range{Offset:0x0, Length:0x0}, Data:[]uint8{0x31, 0x39, 0x37, 0x39, 0x2d, 0x30, 0x35, 0x2d, 0x32, 0x37, 0x54, 0x30, 0x37, 0x3a, 0x33, 0x32, 0x3a, 0x30, 0x30, 0x2d, 0x30, 0x38, 0x3a, 0x30, 0x30}, next:-1, child:0}
[exit status 1]
FAIL: /tmp/testscript2668849915/test_toml_import.txtar/script.txtar:1: unexpected command failure
error running test_toml_import.txtar in /tmp/testscript2668849915/test_toml_import.txtar
@qjcg qjcg added NeedsInvestigation Triage Requires triage/attention labels Jul 30, 2024
@mvdan
Copy link
Member

mvdan commented Jul 31, 2024

ah, datetimes aren't supported just yet, they are a TODO in the code :) thanks for reporting.

@mvdan mvdan added encoding and removed Triage Requires triage/attention labels Jul 31, 2024
@mvdan mvdan self-assigned this Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants