I want an alternative to Python that can provide the same awesome batteries-included experience. I am also considering Nim but I want a language with a strong industry backing.
I want an alternative to Python that can provide the same awesome batteries-included experience. I am also considering Nim but I want a language with a strong industry backing.
https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver...
That server is not remotely comparable to the one in Go.
The Java one is not usable in anything beyond hello world, and is explicitly not intended to be.
I mean it would be trivial to implement that reverse proxy in Go. And I do mean trivial; Go also includes a reverse proxy utility, so you can implement something basic in about 5 LOC.
At this point it’s hard to believe you’re being genuine.
A weekend project and going at scale isn't the same thing.
Edit: or will ever be. It is definitely explicitly not an equivalent of go's net/http. Indeed, there is probably never going to be an equivalent of net/http in the Java stdlib (since they prefer to rely on the user choosing one of the existing server frameworks, such as Jetty).
https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver...
I see it's still available after the modularization effort, and it is:
https://docs.oracle.com/en/java/javase/18/docs/api/jdk.https...
> Provide a command-line tool to start a minimal web server that serves static files only. No CGI or servlet-like functionality is available. This tool will be useful for prototyping, ad-hoc coding, and testing purposes, particularly in educational contexts.
> It is not a goal to provide a feature-rich or commercial-grade server. Far better alternatives exist in the form of server frameworks (e.g., Jetty, Netty, and Grizzly) and production servers (e.g., Apache Tomcat, Apache httpd, and NGINX).
In Go you can write a production ready, well tested, _concurrent_ web application with routing, auth, sql storage, html templating, image optimization, and so on without fetching third party libraries. And you’re not leaving official docs for it.
Compared to sat Rust Go has a very large and practical std lib ! You can actually do something with it I/O wise.
To save some of my karma points, Rust do have a big "community with crates"
My team uses Go whereas the rest of the company heavily uses Python. Our vulnerability scanner tool detects hundreds of high score CVEs just in their container images. Comparably there have been times I haven’t updated our distroless base image for a year and there isn’t even a single vulnerability (this one: https://github.com/GoogleContainerTools/distroless/blob/main...)
In terms of defending your software supply chain, eliminating the cruft that is required to run an interpreted language in a container make a a huge difference.
Go has a runtime, of course, but it’s part of the binary.
Actually, the single binary alone is worth the effort. But it goes much deeper than that.
> what about support of smtp
Yes, https://pkg.go.dev/net/smtp
> data serialization formats
What you can find in the "encoding/*" subpackages: JSON, XML, Gob, CSV, ...
My first time with Go was one of the rare experiences, where I just wrote code in a new language (some cryptography, some interactions with rest APIs), and it just worked. No wrestling with obscure features, no hidden magic.
Currently I use it very often for various side projects.
> These are predefined layouts for use in Time.Format and time.Parse. The reference time used in these layouts is the specific time stamp:
01/02 03:04:05PM '06 -0700 (January 2, 15:04:05, 2006, in time zone seven hours west of GMT). That value is recorded as the constant named Layout, listed below. As a Unix time, this is 1136239445. Since MST is GMT-0700, the reference would be printed by the Unix date command as:
Mon Jan 2 15:04:05 MST 2006 It is a regrettable historic error that the date uses the American convention of putting the numerical month before the day.
Using the American convention is regrettable, but putting the year after the time is even more regrettable IMHO. Not sure which timestamp format does that? Plan 9?
But to answer the question: yes, Go has support for SMTP in net/smtp and a lot of different serialization formats in encoding/
You can browse it all here: https://pkg.go.dev/std
I think it's comparable to Python.
Go's stdlib was one of the reasons I ended up with Go instead of Rust (might have changed; Rust had a lot community content, but not a comprehensive stdlib; last checked 3-4 years ago).
Still the case now (depending on your definition of ‘comprehensive’ of course). It’s an explicit non-goal of Rust to include “everything” (eg. http, crypto, random numbers) in std because of the stability promises - you can’t make breaking changes to std unless you’re fixing a soundness issue AFAIR.
A stdlib must not contain everything but a solid cryptography lib is probably a good idea.
I would still like to have a more comprehensive or high level stdlib for Rust that is maintained by a core Rust team.
Idiomatic Go eschews frameworks and - as a former Java developer - that is something I really like about it.