hofstadter-io / cuetorials.com

Learn you some CUE for a great good!
https://cuetorials.com
BSD 3-Clause "New" or "Revised" License
115 stars 34 forks source link

Validation fails to build instance #77

Open shortwavedave opened 1 year ago

shortwavedave commented 1 year ago

In the example here: https://cuetorials.com/go-api/loading/#loading-and-printing-cue-code

it says:

// to cause a load error, remove the '&'
// to cause a build error, change '#A' to '#B'
// to cause a validation error, change foo to '1'

However, the third case actually produces a build error. I'm not sure it's possible to reach this line

fmt.Println("Error during validation:", err)

Am I missing something?

verdverm commented 1 year ago

Probably not, things have changed since that was written. The CUE evaluator is going through changes and I've learned more about how this stuff works while adding def, eval, export, vet commands and flags to hof and making outputs match. I plan to rework the go-api section this month.

Feel free to nag if you don't see it updating!

In the meantime, you can use the new hof tui at the head of _dev to toggle the different options to Validate and Syntax and how they will affect the output. I just thought up the idea to generate the Go code for you from a playground in hof tui... that's going to be sweet