> Docker is built with Go. Compare doing things with Docker api between Go and Python. I usually recommend people to "script" things with Go but I start to think that Go has to go... https://docs.docker.com/engine/api/sdk/examples/
The very first example of the SDK page is quite a shock. To "run a container" in Python is 3 LOC. To do the same in Go takes 56 LOC. But why? I can imagine one could add a simple method to the Go SDK to mimic what the Python SDK is doing, but that's not the case. So, why this huge difference? One solution is "Pythonic" and the other is "the gopher way"?
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.
The Go SDK is very low level, and a lot of the high level stuff happens inside the client code in a way that is hard to extract. There was an effort to abstract that in a way that could be reused but it was never prioritized so got stuck on the backburner. I attempted to create a separate SDK that the Docker client didn't build upon, but, if I recall correctly, there wasn't much appetite to do that because then we would have to maintain two codebases and it wouldn't automatically get better when we fixed bugs/improved things in the Docker client.
Here was the prototype: https://github.com/bfirsh/docker-sdk-go
As others say here, Go code does tend to be more verbose, but the Docker Go SDK is very low level and could be higher level. It doesn't have a `Run()` function for example, and there is no technical reason why it couldn't.
- Installing 3rd packages such as the docker SDK easier
- Programs are more portable and easier to distribute