
Ask HN: CLI – Java or Python or Go? - itpragmatik
We want to write a command line interface tool that will be distributed to our customers. It is intended to be used on Linux. This CLI tool primarily will do few remote REST API calls, copy large number of big files from local file system to remote server (like AWS S3) and is expected to take few hours to complete.  We have lot of in-house Java expertise. Should we pick Go, Python, Java or some other language? I am biased towards Java but would like to hear additional opinions.
======
kevinherron
A lot of people here are suggesting Go for its single binary with no
dependencies, but if you're starting a small green field project in Java you
should have no issue making sure it's jlinkable and even compiling it to a
single statically linked binary with Graal.

This way you can re-use your Java expertise and still get a statically linked
single binary with quick startup.

------
haglin
JDK 11 comes with a new HttpClient. Might be useful and fun to learn.

[https://docs.oracle.com/en/java/javase/11/docs/api/java.net....](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html)

------
priom
Go, use cobra. It's awesome and really easy to get started and complete the
project.

~~~
verdverm
Cobra is great, add in Viper for config.

Goreleaser for creating binaries, home brew, os packages, GitHub releases.

------
Karhan
I think you'll have the fewest distribution issues with a go binary. But if
you have lots of experience building and distributing java programs to your
customers then go with what you know!

~~~
danieka
Being able to build Go into a binary without any dependency makes distribution
really easy. As a user I prefer a single file that I can download and run and
as a developer it has really simplified builds and deploys.

~~~
shoo
agreed. for a user to get a python cli to work they will need to install
python and any open source libraries your cli depends on (unless you use some
tool to bundle all the dependencies with your app, in ye olden days this was
py2exe or similar for bundling for windows).

similarly, for java you place the burden on your users to install a jre

with go the standard build toolchain lets you easily cross-compile a bunch of
statically linked binaries, so each user just downloads 1 file for their
target platform and runs it.

personally i am much more productive writing code in python than in go (this
is largely a consequence of spending 20x as much time writing python than go)
but go is dramatically more ergonomic from a deployment perspective and has a
great cross-platform library and cross-compiler support out of the box

------
CyberFonic
I have written several similar programs using Python's cmd.Cmd class. Command
completion, help messages, etc are all taken care of. All I need to do is to
write the nitty gritty for each command and copious log the actions taken
their return status to catch any networking, REST, etc issues. It is even
possible to nest command interpreters within command interpreters to create
sub-commands if applicable.

I should mention that I am more productive in Python than either Java or Go -
so this may taint my view of alternatives.

------
tmaly
I really like using Go for this. The single binary with zero dependencies
makes it really easy to deploy. You do not need the jvm or python environment
setup. If you change something like upgrading your jvm or python or a library,
aside from the path, the binary keeps working.

Maintaining things is just much simpler with a single binary.

------
sethammons
It depends on your customers. Will they have the right version of python? Will
they install the Java runtime environment and the correct one (I assume that
is a thing, but I'm not Java person)?

Or you can skip all of that and just use Go that runs as a single, stand alone
binary and very likely uses less memory than Java.

~~~
_frkl
Alternatively, you could always use pyinstaller to create a single static
binary for a Python app, so no need for python to be installed at all. Not
quite as performant as go, but should be good enough for this use case.

------
vkaku
If you want to integrate with AWS/Azure, Python is the language of choice for
CLI.

It's because the actual AWS CLI/Azure CLI is written in Python and they have
the most supported interface so far known.

I personally like Go because it's easier to ship a static binary but in this
case I would recommend otherwise.

------
Adamantcheese
Java because you have devs and you can just make a shell/batch script to
launch a JAR.

------
m0ck
You ask if you should use Java, Python or Go and the first three replies
recommend you Java, Python and Go in that order, I love it.

------
k0t0n0
> We have a lot of in-house Java expertise. Should we pick Go

Give go an honest try. I am sure it will not disappoint you.

~~~
Foober223
You quote "in-house Java expertise" then recommend Go? Man that is not what
you should quote, and he should use Java.

------
kasey_junk
Go is excellent at building CLI commands of this type. It maybe the thing that
it's best at.

------
pkphilip
Why not rust? Rust has excellent CLI support, is fast, can do REST calls

