Skip to content

Rewrite in Go - #318

Merged
debarshiray merged 52 commits into
containers:masterfrom
martymichal:rewrite-in-go
May 13, 2020
Merged

debarshiray merged 52 commits into
containers:masterfrom
martymichal:rewrite-in-go

Conversation

@martymichal

@martymichal martymichal commented Oct 31, 2019 •

Copy link
Copy Markdown
Member

This is where the Go rewrite is happening. I welcome any kind of comment/contribution.

The shell script has been renamed to toolbox.sh so that toolbox.go can
be compiled.

The new codebase is based on Cobra which takes care of the CLI heavy lifting.

Comment thread cmd/create.go Resolved
Comment thread cmd/create.go Resolved
@cgwalters

cgwalters commented Oct 31, 2019 •

Copy link
Copy Markdown
Collaborator

So first: Let's try to get a vote among contributors here - do you really really want Go? I think the code in #319 is pretty good, Rust's "structopt" is a lot nicer than anything Go can do, etc. But, if you don't know Rust (and don't have the time to learn), that's a totally valid argument against. Go is very easy to learn. It's also valid that podman is in Go.

But I'd hope people at least take a careful look at the toolbox-rs code and think about it!

But I write Go a lot, and I just really dislike the language. The "Go strength" in web services doesn't apply here at all.

On the other hand, hopefully this project doesn't exceed 2000 lines, so it doesn't matter too much.

@dustymabe

Copy link
Copy Markdown
Collaborator

So first: Let's try to get a vote among contributors here - do you really really want Go? I think the code in #319 is pretty good, Rust's "structopt" is a lot nicer than anything Go can do, etc.

But, if you don't know Rust (and don't have the time to learn), that's a totally valid argument against.

I really want to learn more rust and I like the concept of the language.

Go is very easy to learn. It's also valid that podman is in Go.

I think these points are the biggest one in favor of Go and why we have centered on go in previous discussions.

But I'd hope people at least take a careful look at the toolbox-rs code and think about it!

+1 - I looked at it earlier today. I don't quite understand it, because I don't know rust, but it at least looks nice.

But I write Go a lot, and I just really dislike the language. The "Go strength" in web services doesn't apply here at all.

Understood.

On the other hand, hopefully this project doesn't exceed 2000 lines, so it doesn't matter too much.

Agree, Either one should be fine implmentations for this. We should hoist advanced features back into podman.

@evelineraine

evelineraine commented Nov 1, 2019 •

Copy link
Copy Markdown
Contributor

Switching to either opens opportunities for me to contribute to the code (I can't write bash).
Regarding the choice I feel the same as @dustymabe. In a vacuum, I would prefer Rust over Go, because I really like it's design principles (unlike Go's) and toolbox would be a perfect opportunity for me to practice Rust.

However, toolbox not in a vacuum and entire container domain is almost Go-exclusive, which is not exactly good, but means moving toolbox to Go would attract more contributions from people that already work on container projects and also new people (Go is really easy to get started with, after all). Podman being in Go is really important point.

Still, it seems to me an even better option is a scripting/interpreted language. As a wrapper around a complete container solution (podman), I'm not sure what benefit there will be from features of a compiled language like Rust or Go (performance, advanced memory management, complex data representations, direct system calls, etc.).
On the other hand, a scripting language allows easier inspection of the code and easier changing of it, lowering entry-barrier for new people to contribute. And really, until toolbox supports tons of runtime customization, being able to easily mess with the code is very beneficial.

I would make many points in favor of Python, but as I understood because of CoreOS it's a no-go. Is it the case?

@martymichal martymichal changed the title Initial commit of the Go rewrite Rewrite in Go Nov 1, 2019
@martymichal martymichal added 5. Help Wanted Extra attention is needed 6. Major Change May cause breakage labels Nov 1, 2019
@dustymabe

Copy link
Copy Markdown
Collaborator

I would make many points in favor of Python, but as I understood because of CoreOS it's a no-go. Is it the case?

It is true that the CoreOS team has a goal of keeping Python out of the base. See https://github.com/coreos/fedora-coreos-tracker/blob/master/Design.md#approach-towards-shipping-python

@evelineraine

evelineraine commented Nov 2, 2019 •

Copy link
Copy Markdown
Contributor

It is true that the CoreOS team has a goal of keeping Python out of the base. See https://github.com/coreos/fedora-coreos-tracker/blob/master/Design.md#approach-towards-shipping-python

I see, thanks for the reference. Python is not an option then (unless you feel like freezing binaries) :(

So to me it seems Go has more advantages if starting from scratch. At the same time there is cgwalters/coretoolbox which is an already functional implementation. Between the two, I'm not sure what I would choose. Very curious to see how this decision goes.

@giuseppe

giuseppe commented Nov 4, 2019

Copy link
Copy Markdown
Member

If you pick Go, I'd also suggest to use podman directly from the CLI, or alternatively through varlink.

The libpod version vendored by toolbox may be different than what Podman uses. I don't think we are ready for supporting two versions of libpod that run and manage the same storage.

@dustymabe

Copy link
Copy Markdown
Collaborator

The libpod version vendored by toolbox may be different than what Podman uses. I don't think we are ready for supporting two versions of libpod that run and manage the same storage.

Yes. Agree. This is something we had previously discussed as well and we agreed to not vendor libpod.

@martymichal
martymichal force-pushed the rewrite-in-go branch 5 times, most recently from 9542708 to 58e3dac Compare November 7, 2019 17:38
@softwarefactory-delete-me

Copy link
Copy Markdown

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@softwarefactory-delete-me

Copy link
Copy Markdown

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@softwarefactory-delete-me

Copy link
Copy Markdown

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@martymichal martymichal added this to the Golang rewrite milestone Dec 5, 2019
@softwarefactory-delete-me

Copy link
Copy Markdown

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@softwarefactory-delete-me

Copy link
Copy Markdown

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

1 similar comment
@softwarefactory-delete-me

Copy link
Copy Markdown

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

debarshiray and others added 18 commits May 13, 2020 12:59
... based on the default values, and those overridden by the user.

containers#318
The Go version supports specifying the name of the new toolbox
container as 'toolbox create NAME', in addition to the existing
'toolbox create --container NAME' form.

containers#318
For some reason, the State:Pid value in the JSON returned by
'podman inspect --format json --type container' is a float64 [1], even
though internally Podman represents it as an int.

[1] podman-container-tools/podman#6105

containers#318
The Go version supports specifying the name of the toolbox container as
'toolbox enter NAME', on top of the 'toolbox enter --container NAME'
form.

containers#318
@abitrolly

Copy link
Copy Markdown

No way! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5. Help Wanted Extra attention is needed 6. Major Change May cause breakage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants