tliron / puccini

Cloud topology management and deployment tools based on TOSCA
https://puccini.cloud
Apache License 2.0
88 stars 20 forks source link

Compilation error #110

Closed jpc4242 closed 1 year ago

jpc4242 commented 1 year ago

Using commit 3289a4489ea409101d28cd8c42d7bfb6057566a2

scripts/build gives this error

# github.com/tliron/puccini/clout
../clout/edge.go:130:19: reflector.Unpack undefined (type *ard.Reflector has no field or method Unpack)
../clout/edge.go:157:15: undefined: util.UnmarshalMessagePack

I see than kutil/ard has Unpack added in v0.1.62 (ARD and reflection improvements ) and go.mod from this clone of puccini still has 0.1.61 So I update go.mod, try scripts/build, execute all the go get it suggests, and when running scripts/build again I get now:

# github.com/tliron/puccini/clout/js
../clout/js/context.go:50:24: undefined: terminal.Stdout
../clout/js/context.go:51:24: undefined: terminal.Stderr
../clout/js/context.go:53:24: undefined: terminal.Stylize

And those missing seem to be caused by the changes between v0.1.61 and v0.1.62 in kutil (switch to termenv library )

I guess I should be using 0.1.61 for kutil/terminal and 0.1.62 for kutil/ard, but I don't know if that's even possible (I'm a golang noob)

tliron commented 1 year ago

Oof, yes, this is a bit of a mess, sorry, but should be easy to fix. Let's try this:

Edit go.mod and change the version for kutil to 0.1.62. Then run go mod tidy (that syncs go.mod with go.sum). And now it should build correctly... I hope...

ashish-gupta-2 commented 1 year ago

Hi , Updated the version of kutil to 0.1.62, still, it's failing to build.

$ ./scripts/build
# github.com/tliron/puccini/clout/js
../clout/js/context.go:50:24: undefined: terminal.Stdout
../clout/js/context.go:51:24: undefined: terminal.Stderr
../clout/js/context.go:53:24: undefined: terminal.Stylize
tliron commented 1 year ago

Thank you for trying. If you're not tired of it already, here is a fix. Clone the kutil repository. Now, create a file named go.work in the Puccini repo directory with the following contents:

go 1.19

use .

replace github.com/tliron/kutil => ../kutil

Use the right absolute or relative path to the kutil repository. Run go mod tidy again. And now it should work, I hope. :)

I'm sorry for this mess. I've been the sole developer for now, so I've been playing fast and loose with commits.

jpc4242 commented 1 year ago

Hi @tliron I tried that and I still get:

# github.com/tliron/puccini/clout/js
../clout/js/context.go:50:24: undefined: terminal.Stdout
../clout/js/context.go:51:24: undefined: terminal.Stderr
../clout/js/context.go:53:24: undefined: terminal.Stylize

The problem is that kutils 0.16.2 change (w.r.t. v0.16.1) removed some terminal. elements and added reflector.Unpack. Latest puccini version depends already on Unpack but also still depends on the old terminal. things.

But fortunately I found that there is an intermediate commit, so I found the following workaround:

# Delete old version
rm -rf puccini
# Clone puccini
git clone https://github.com/tliron/puccini.git
cd puccini/
# Force use of the kutil version that had already added Unpack but hadn't removed terminal.* yet
go get github.com/tliron/kutil@4ad2fa3eadd21eb5441e14da6636d67ce0ff478a
go mod tidy
#Build works again
./scripts/build

I guess the long-term solution is to remove forom puccini the remaining dependencies on the terminal.* elements that are no longer present in kutil as ov v0.16.2

tliron commented 1 year ago

Thanks for figuring it out. The long-term solution is that I need to test better before committing. :) I work with a local go.work and sometimes forget. I'm in the midst of a big change right now (refactoring constraint calls) so it's a bit messy. Once I finish this work and merge I promise to be more vigilant moving on.

jpc4242 commented 1 year ago

No need to apologize, you get what you pay for so puccini's quality-price relationship is infinite

tliron commented 1 year ago

This should be fixed with the latest commits to both libraries.