News for hackers. Stuff that matters.
Re:Show HN: Encrypted VPN in 2k lines of Go by sAbakumoff on Thursday October 05, 2017 @04:27AM (#15407485)
Is it just me or Golang started gaining momentum recently? More and more related articles/OSS projects/HN links show up every day.
Re:Show HN: Encrypted VPN in 2k lines of Go by lurker- on Thursday October 05, 2017 @06:04AM (#15407923)
When I first saw Go I was put off by its syntax, but after giving it a chance I very quickly fell in love with it.

I've used C#, Python, Ruby, Java, C, Obj-C, JS and Go for mid-large scale projects. Go is the only language I've ever truly loved; sometimes I even feel like I'm writing poetry (as ridiculous as that may sound).

The community is really incredible^, I've yet to encounter anything that didn't have great documentation or solved by packages. My favorite SO answer of any language is probably this one by icza: https://stackoverflow.com/questions/22892120/how-to-generate... . I also feel that it's very easy to read and understand other peoples code compared to other languages (imo, the only aspect of Go that I think can be difficult for newcomers to grasp is pointers). All in all, I feel very confident that I'll still be writing Go code after ten years.

^ (Although I hate when certain "elitists" downvote questions because they feel they've been sufficiently answered elsewhere.. if a SO answer says how to display time to YYYY-MM-DD:HH-MM then don't complain if someone ask how to display time as YYYY-MM-DD.. I have a strong dislike towards jquery (or rather JS), but I think the great thing about jquery is that every imaginable edge-case seem to be documented)

Re:Show HN: Encrypted VPN in 2k lines of Go by sAbakumoff on Thursday October 05, 2017 @08:18AM (#15408508)
Yeah, I also love Golang, though I am a full-job front-end developer. Sometimes it can make me shout "WHAT THE FUCK"[1] to the IDE, but it's the most enjoyable language I worked with during last 20 years.

[1] http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in...

Re:Show HN: Encrypted VPN in 2k lines of Go by scaryclam on Thursday October 05, 2017 @06:18AM (#15407980)
Genuine question as I've only dabbled in Go, but I've heard complaints from other dabblers that Go seems to encourage large files rather than breaking things up in a more modular fashion. Is that a reality? Or has the complainer just been unlucky in the code they've viewed?
Re:Show HN: Encrypted VPN in 2k lines of Go by fmpwizard on Thursday October 05, 2017 @07:14AM (#15408228)
I have been using Go for about 4 years at work and I would say they have been unlucky with the code they have looked at. You have the freedom to organize your code as you wish, you can easily go from one extreme to the other, one function per file to 1000 in one file. The only thing that isn't encouraged is to have very small packages, for example, if your project ends up split into 10 packages, but each of them is just one file (or one code file plus a test file), then most Go developers would suggest to group more files into a single package.
Re:Show HN: Encrypted VPN in 2k lines of Go by sethammons on Thursday October 05, 2017 @09:01AM (#15408772)
To add some meat onto that: a package should be usable (and reusable) on its own. If you have a package that is a single function or struct, it is unlikely (but still possible!) to be useful on its own and likely requires the context of your other packages to be useful.
Re:Show HN: Encrypted VPN in 2k lines of Go by Cthulhu_ on Thursday October 05, 2017 @08:27AM (#15408561)
I've only dabbled myself, but I can see how that would start; I come from a Java background which forces you to have one module / class per file, but Go doesn't. It's very easy to start hacking up a thing, and it's easier in development to just keep it in one file. Of course, the nature of code is that it grows, so spend enough time there and it'll start growing. If you're familiar with the code (as in, you wrote it yourself), single files shouldn't be a problem.

It's not uncommon in other projects either, NodeJS for example has a relatively small number of large files (https://github.com/nodejs/node/blob/master/src/node.cc).

Re:Show HN: Encrypted VPN in 2k lines of Go by geodel on Thursday October 05, 2017 @10:09AM (#15409272)
Go definitely prefers modular fashion. But definitely no gratuitous files/packages structure like Java where a dozen packages each with 2-3 files having nothing more than 50 lines of code out of which 30 are comments and imports of another dozen packages.

Unlike Java, Go does not have limitation of having each public class in its own file. So public symbols of any type can be put together in same file if it makes sense. Go prefers arranging code what makes sense for application functionality instead of auto-generated scaffolding like 'handlers', 'utils', 'assets', 'entities' etc like I do in my Java code.

Re:Show HN: Encrypted VPN in 2k lines of Go by richardknop on Thursday October 05, 2017 @08:02AM (#15408417)
Most of Go code I was working on or contributed to usually has quite a split out structure and more complex structs are defined in multiple files with related methods grouped together. I have seen couple of Go packages which consist of one huge file but I think it's quite rare. Most people will structure their code into multiple files to keep it more readable/maintainable and file sizes relatively small.
Re:Show HN: Encrypted VPN in 2k lines of Go by insertnickname on Thursday October 05, 2017 @06:49AM (#15408117)
I don't see any reason why Go would encourage large files. A Go package consists of every Go source file in a directory. You can use as many or as few files as you want per package.
Re:Show HN: Encrypted VPN in 2k lines of Go by captncraig on Thursday October 05, 2017 @07:26AM (#15408282)
We don't really have the "one class one file" beat into us like in java or c#. That means you gotta think a little to see how a package naturally splits up. Some people are better at that then others.
Re:Show HN: Encrypted VPN in 2k lines of Go by scaryclam on Thursday October 05, 2017 @07:01AM (#15408178)
Yeah, I found it a strange assertion to make, so was wondering if it held any water. Sometimes different languages have different ways of working, which seem odd to novices entering the space from a different background, so I didn't want to assume that they were wrong.

Looks like it may be a case of coming across some less well written projects and making assumptions about the entire language, which is nice as Go seems fun :)

Re:Show HN: Encrypted VPN in 2k lines of Go by terminalcommand on Thursday October 05, 2017 @05:58AM (#15407893)
I think Golang is very suitable for network programming tasks. It gives you wonderful libraries to work with sockets, strict rules to structure your code, automatic memory management, goroutines for concurrent programming etc.

Most network related small apps were written in C, now you can write them in Go. With the added benefit of simple libraries, memory management and goroutines. You don't have to mess arround with platform specific sockets, threading libraries etc. Plus every piece of code you open is written in understandable Go. With C, there is years of baggage, multiple standards, pre-compiled headers, undefined behaviour etc.

And lastly, new is always more exciting than old :)

Re:Show HN: Encrypted VPN in 2k lines of Go by ikeyany on Thursday October 05, 2017 @07:42AM (#15408329)
No it's not you [0]. Rust, Go, R, and Python have the highest year-to-year growth.

[0] https://stackoverflow.blog/2017/09/06/incredible-growth-pyth...

Re:Show HN: Encrypted VPN in 2k lines of Go by Cthulhu_ on Thursday October 05, 2017 @08:24AM (#15408533)
Python is interesting in that list, given how it's at least 4 times as old as all of the other ones in that list. What's behind that? I don't recall any major developments after Python 3, and most of the news behind that one was about its backwards incompatibility (and currently how 2.x isn't about to go anytime soon)
Re:Show HN: Encrypted VPN in 2k lines of Go by rrdharan on Thursday October 05, 2017 @10:51AM (#15409602)
Explosion of interest in machine learning and data science and decent Python-based tools for those fields.
Re:Show HN: Encrypted VPN in 2k lines of Go by pricechild on Thursday October 05, 2017 @08:28AM (#15408572)
They followed up on that question with another blog post: https://stackoverflow.blog/2017/09/14/python-growing-quickly...
Re:Show HN: Encrypted VPN in 2k lines of Go by goatlover on Thursday October 05, 2017 @11:25AM (#15409925)
Python's huge popularity in scientific computing fields along with it being widely taught in schools. Notice also that R was on the list, which is obviously due to huge uptick in data science. R has been around for awhile as well.