top | item 32581510

(no title)

Queue29 | 3 years ago

If your goal is to minimize lines of code, sure, Python takes the cake here.

But here's a different way of looking at it: using only Python example, can you identify every way that launching that container might fail?

Now do the same with the Go example. See the difference? Folks who value looking at a piece of code and knowing what might happen - not just in the happy path but also in the error path - I think will likely appreciate the Go sample.

discuss

order

thunky|3 years ago

In this specific example, I can't imagine how all of this exposed plumbing and error handling adds much value for the person reading or writing the code. In fairness, however, the Go code could easily be moved into function that does all of the dirty work and presents a minimal interface...which is what the Python example is doing:

https://github.com/docker/docker-py/blob/923e067dddc3d4b86e4...

danwee|3 years ago

Sure, but why not adding the "easy way of doing things" as well in the Go SDK? It certainly would help a lot when writing prototypes and trying things out. Later on, sure you can rely on the most robust approach (which yes, I agree, Go does seem more robust in the particular examples in the SDK page)