capnproto / go-capnp

Cap'n Proto library and code generator for Go
https://capnproto.org
Other
1.2k stars 108 forks source link

I had some problems running the bookstest1 case. #550

Closed Mats-Tan closed 10 months ago

Mats-Tan commented 10 months ago

May I ask why the following error occurs when I run the go-capnp case? I have checked the location of the error and these definitions all exist.

I use Windows10, glang language version is 1.21.1, capnp version is 1.0.1.

Mats-Tan@LAPTOP-EOJ63LIG MINGW64 /e/CodeSpace/go-capnp/example/books/ex1 (main)
$ go run books1.go 
# books
..\books\books.capnp.go:37:25: capnp.Struct(s).EncodeAsPtr undefined (type capnp.Struct has no field or method 
EncodeAsPtr)                                                                                                   o-get=1: 404 Not
..\books\books.capnp.go:41:29: capnp.Struct{}.DecodeFromPtr undefined (type capnp.Struct has no field or method DecodeFromPtr)
..\books\books.capnp.go:85:24: undefined: capnp.StructList
..\books\books.capnp.go:90:15: undefined: capnp.StructList
..\books\books.capnp.go:97:21: f.Future.Ptr undefined (type *capnp.Future has no field or method Ptr)
Mats-Tan commented 10 months ago

Instead of using the code in the example, creating my own module and writing it myself is no problem. I this this problem may be caused by the inconsistency between the version of the go module in the example and my version.

lthibault commented 10 months ago

Hello, are you importing capnproto.org/go/capnp/v3? I suspect you are importing an older version. Note that you may need to go get capnproto.org/go/capnp/v3@main to pull the latest version. Note that the @main part is important.