hofstadter-io / hof-docs

Moved to the hof repo
https://docs.hofstadter.io
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Simple Server / Using instructions for generation do not work #5

Closed halostatue closed 2 years ago

halostatue commented 2 years ago

https://docs.hofstadter.io/first-example/simple-server/using/ has an instruction to run hof gen ./example, which fails.

❯ hof gen ./example
LoadCue: import failed: cannot find package "hof.io/docs/first-example/gen" true []
import failed: cannot find package "hof.io/docs/first-example/gen":
    ./example/gen.cue:4:2

This may be related to https://docs.hofstadter.io/first-example/simple-server/setup/ instructions on CUE module creation:

hof mod init cue hof.io/example

Changing the instruction to

hof mod init cue hof.io/first-example

Also does not work.

Changing the instruction to

hof mod init cue hof.io/docs/first-example

Results in an error in a different location:

❯ hof gen ./example
LoadCue: import failed: import failed: cannot find package "github.com/hofstadter-io/hof/schema/gen" true []
import failed: import failed: cannot find package "github.com/hofstadter-io/hof/schema/gen":
    ./example/gen.cue:4:2
    ./gen/server.cue:4:2

This may be related to an incomplete configuration in cue.mods (comparing the two folders):

--- hof-first-example/cue.mods  2022-06-06 16:36:59.000000000 -0400
+++ ./cue.mods  2022-06-06 16:39:04.000000000 -0400
@@ -1,3 +1,7 @@
 module hof.io/docs/first-example

-cue v0.4.0
+cue v0.4.1
+
+require (
+   github.com/hofstadter-io/hof v0.6.1
+)
halostatue commented 2 years ago

The same error shows up in a local clone of hof-docs/code/first-example/simple-server. I am stuck moving forward in the tutorial / worked first example from this point.

verdverm commented 2 years ago

Thanks for the report @halostatue, I'll try to go through them myself.

Each folder is trying to relate to the section, such that new sections start at the completion of the previous section. It may be that I fixed things in later sections and did not backport them to previous sections.

If you are interested, I can schedule a time to stream this live on Twitch this week. That is where I typically proofread the docs

halostatue commented 2 years ago

I’m mostly interested in going through the worked first example to make sure that I can understand what hof is doing to see if it’s appropriate for something my team is building. This isn’t urgent for us, so I’ll just keep an eye on progress via this ticket, if that’s OK.

verdverm commented 2 years ago

sure, I'll let you know once I have made the updates. Thanks for the reports and your patience

verdverm commented 2 years ago

btw, I think you need to run hof mod vendor cue to fetch the missing dependency, in addition to the fixes you have above

verdverm commented 2 years ago

dev note: bump multiple versions when making the fixes and updates

halostatue commented 2 years ago

hof mod vendor cue got me further along. Now I get the following error:

❯ hof gen ./example -s
Server.In.SERVER.Port: cannot convert non-concrete value >1024 & int (and 2 more errors)

Errors while loading generators

Once I removed the Port: int & >1024 definition (and a couple of other items that differed from the hof-docs/code/… example), I was able to move forward.

I haven’t moved forward on this tonight, as I have other things to do tonight. I’ll get back to it later this week.

verdverm commented 2 years ago

first-example/simple-server should be fixed now. Subsequent sections are up next!