Re: [osv-dev] Re: Capstan Build Fail and Fix

2019-11-26 Thread Pekka Enberg
Hi,

On Mon, Nov 25, 2019 at 6:59 PM Waldek Kozaczuk 
wrote:

> I am not golang expert either. Maybe others, original authors of capstan
> on the list can chime in. I will look into myself. If there is a lot of
> work we might just explicitly stick with v1. Either way, it would be good
> to express the explict dependency on the specific version rather than
> always use master. What is the right way to do in golang?
>

Vendoring (IOW, keeping full copies of the dependencies) used to be the
thing to do, but not sure what Gophers do these days.

But, you probably should anyway just update capstan.git to use the new
APIs, because at some point the older versions will stop working for one
reason or another.

- Pekka

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/CAGUyND_S%3DXaG3uJTtYCbyMF10SrYPRwb8JNAS0ifHbPxNqP5mg%40mail.gmail.com.


[osv-dev] Re: Capstan Build Fail and Fix

2019-11-25 Thread Waldek Kozaczuk
I am not golang expert either. Maybe others, original authors of capstan on 
the list can chime in. I will look into myself. If there is a lot of work 
we might just explicitly stick with v1. Either way, it would be good to 
express the explict dependency on the specific version rather than always 
use master. What is the right way to do in golang?

Meanwhile, you can use fairly fresh capstan binaries published on github - 
https://github.com/cloudius-systems/capstan/releases/tag/v0.4.1 - look at 
assets.

Waldek

On Monday, November 25, 2019 at 2:53:16 AM UTC-5, Kay Haw wrote:
>
> Capstan uses urfave/cli  as cli module, to 
> be more specific, the master branch of urfave/cli, unfortunately, the 
> authors made some API changes into the matser branch 
>  
> recently,
>  if I download and build capstan according to Installation.md 
> 
>
> go get github.com/cloudius-systems/capstan
> go install github.com/cloudius-systems/capstan
>
> Building will fail since API changed, seen as below:
> # github.com/cloudius-systems/capstan/util
> go/src/github.com/cloudius-systems/capstan/util/repository.go:108:19: 
> c.GlobalString undefined (type *cli.Context has no field or method 
> GlobalString)
> go/src/github.com/cloudius-systems/capstan/util/repository.go:109:16: 
> c.GlobalBool undefined (type *cli.Context has no field or method GlobalBool)
> go/src/github.com/cloudius-systems/capstan/util/repository.go:112:6: 
> c.GlobalString undefined (type *cli.Context has no field or method 
> GlobalString)
> go/src/github.com/cloudius-systems/capstan/util/repository.go:113:22: 
> c.GlobalString undefined (type *cli.Context has no field or method 
> GlobalString)
> # github.com/cloudius-systems/capstan/provider/openstack
> go/src/
> github.com/cloudius-systems/capstan/provider/openstack/openstack_auth.go:21:16:
>  
> cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in 
> array or slice literal:
> cli.StringFlag does not implement cli.Flag (Apply method has pointer 
> receiver)
> go/src/
> github.com/cloudius-systems/capstan/provider/openstack/openstack_auth.go:22:16:
>  
> cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in 
> array or slice literal:
> cli.StringFlag does not implement cli.Flag (Apply method has pointer 
> receiver)
> go/src/
> github.com/cloudius-systems/capstan/provider/openstack/openstack_auth.go:23:16:
>  
> cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in 
> array or slice literal:
> cli.StringFlag does not implement cli.Flag (Apply method has pointer 
> receiver)
> go/src/
> github.com/cloudius-systems/capstan/provider/openstack/openstack_auth.go:24:16:
>  
> cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in 
> array or slice literal:
> cli.StringFlag does not implement cli.Flag (Apply method has pointer 
> receiver)
> go/src/
> github.com/cloudius-systems/capstan/provider/openstack/openstack_auth.go:25:16:
>  
> cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in 
> array or slice literal:
> cli.StringFlag does not implement cli.Flag (Apply method has pointer 
> receiver)
> go/src/
> github.com/cloudius-systems/capstan/provider/openstack/openstack_auth.go:26:16:
>  
> cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in 
> array or slice literal:
> cli.StringFlag does not implement cli.Flag (Apply method has pointer 
> receiver)
> go/src/
> github.com/cloudius-systems/capstan/provider/openstack/openstack_auth.go:27:16:
>  
> cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in 
> array or slice literal:
> cli.StringFlag does not implement cli.Flag (Apply method has pointer 
> receiver)
> There are two ways to fix this problem
>
>1. Correct the code one by one
>2. Specify the version with *go module*
>
> The first choice is a manual work, I find a correct method 
>  by 
> adding `&` for `Apply method has pointer receiver` error but I'm not 
> clear about how to fix the others since I am a newbie in Go, here is how I 
> solve it with *go mod*
> git clone g...@github.com:cloudius-systems/capstan.git
> cd capstan
> go mod init github.com/cloudius-systems/capstan  #Generate the go.mod file
> go build
> There are still two errors in `capstan.go` file when building, but fix is 
> much easier.
> --- a/capstan.go
> +++ b/capstan.go
> @@ -161,7 +161,7 @@ func main() {
> // Check for orphaned instances (those 
> with osv.monitor and disk.qcow2, but
> // without osv.config) and remove them.
> if err := 
> util.RemoveOrphanedInstances(c.Bool("v")); err != nil {
> -