18 ms·
Go Creeping In
- nl 7y agoI like Go a lot. I just wish there was as much support in Go for machine learning as there is in Python. At the moment, I feel like the whole "Python is the second best language for every problem" makes it the default choice for a lot of people.
- struct 7y agoI wrote a lot of (and still occasionally maintain) a library called golearn [1] which tried to bring first-class support for the “traditional” ML algorithms, but it seems that Go’s compiler and toolchain just don’t optimise well enough for Go to be very competitive on performance for that application. That’s not a criticism of Go, it’s just that C/C++/FORTRAN have decades of optimising compiler support and most competing solutions are Python sugar over a nest of such C/C++/FORTRAN libraries. Go’s also concurrent, which is nice, but we found cases where being too concurrent also cost performance for most people. I’m still optimistic that Go has a place in ML, but it’s probably not right now. [1] https://github.com/sjwitworth/golearn https://github.com/sjwitworth/golearn
- elmolino89 7y agoProper link: https://github.com/sjwhitworth/golearn https://github.com/sjwhitworth/golearn
- struct 7y agoApologies (I was on mobile!)
- nl 7y agoI do wonder if bridging to a good matrix/tensor library would be sufficient (as it is in Python). I'm aware of the interesting work happening in Swift/Tensorflow and was wondering what the equivalent in Go would look like.
- Intermernet 7y agoHave a look at gorgonia. https://github.com/gorgonia/gorgonia https://github.com/gorgonia/gorgonia
- chewxy 7y agoTo add to that, while Gorgonia's Tensor (https://github.com/gorgonia/tensor https://github.com/gorgonia/tensor) library is fairly mature, plenty of work can still be done. Gorgonia proper too has plenty of work to be done on improving the various VMs. Last, there is greenfield work to be done in making Gorgonia user friendlier
- DiabloD3 7y agoI just don't think Go has a place in new code. I know Googlers (who shall remain unnamed to protect the innocent, and politics at that company can kill your career) who joined the Go fandom because its their company's language, their department was C++ or Google-flavored Java heavy (arguably, a Java style worse than 'normal' Java or Android's dialect), and it was their only way out... However, when they were exposed to Rust, a lot of them converted to Rust, and now write Rust for Google on internal apps that need performance but safety, especially during concurrency. Others were exposed to Kotlin (especially due to the Android guys), and are championing that as a replacement for Google-flavored Java inside the company, since the JVM is also very sane when it comes to large scale safety during concurrency. So yeah, if I was writing brand new highly concurrent coroutines-like code, I'd skip Go and Goroutines, and go straight to Kotlin and Akka (not written in Kotlin, but very natural to use with Kotlin), since I end up with the power of the JVM, the elegance of Kotlin's syntax, and the Erlang Actors brought by Akka. And for those who have never used Erlang, learn it once, write something highly concurrent in it, and you'll learn to distaste almost every other language's faulty concurrency idioms almost immediately. Without the Erlang actors model, you're not going to be writing fault tolerant concurrent systems; just like "all languages converge until they become LISP", all concurrency systems converge until they become an Erlang actor model.
- agumonkey 7y agoSo LFE will reign http://lfe.io/ http://lfe.io/ LFeO even ;)
- brobdingnagians 7y agoI was curious about learning LFE, but didn't see if it was able to interface with Phoenix (Elixir's web server). Is there any way to use Phoenix from LFE?
- fetbaffe 7y agoWhy shouldn’t Go have a place i new code? You talk about Rust, but why does that make Go a bad choice? Is it technical reasons or politics?
- chuhnk 7y agoIt's amazing to see more and more finding Go. For a lot of us it's been almost a decade since we started using it. Back then for me it was the perfect blend between C and ruby. Today I believe it's the language of distributed systems and the cloud. I personally think Go ends up with majority marketshare for all cloud native systems and its already going in that direction with the core tools like docker, kubernetes, etcd, grpc all using it. By extension of that I believe a signifcant number of backend systems and services in the cloud will also predominantly be Go based. This doesn't rule out other languages, its merely an indicator of a trend we've seen time and time again related to platforms. Windows, Linux, Android, etc. Every platform has a dominant language. Other newer up and comers like typescript, rust, swift, kotlin, etc have their place but for their respective platforms. Go's adoption will accelerate in the next decade but you'll also find it disappear into the background as development as a whole levels up beyond the languages of today. Only us millenials and older generations will speak of it. The next generation will be preoccupied with an entirely different model of programming.
- dunk010 7y agoAnd what model of programming do you suggest it might be? ;-D
- brodsky 7y agoTraining AIs. I strongly believe this will be an occupation class in the future.
- jessaustin 7y agoThe next generation will be preoccupied with an entirely different model of programming. Has there been a "generation" of programmers who didn't dream this dream?
- MikeOfAu 7y agoThe rise of Kubernetes will likely enhance go's presence in devops.
- EdwardDiego 7y agoHow much Go do you have to write to use K8s though? So far all I've seen is YAML.
- olalonde 7y agoYou don't need to write any unless your fixing bugs or contributing to the project (I'd say parent's comment still stands though).
- EdwardDiego 7y ago> I'd say parent's comment still stands though That people will appreciate Go because a tool is written in it? I'm dubious. I use Kafka on a daily basis and read its source code with regularity to better understand its behaviour. and while I love what Kafka can handle, and how resilient it is, it doesn't enamour me more, or less, of Scala. What I love about Kafka has little to do with the language and everything to do with the architecture and design of the system. Go is probably more readable than a lot of the legacy Scala in Kafka admittedly (although their new Scala and Java code is far more readable) which I guess could convince people to give it a try.
- GrigoriyMikh 7y agoWell, maybe you have to write third party controller(or operator) for k8s. That was actually a case for me, recently
- quickthrower2 7y agoTerraform too
- acln 7y agoThe most important property of Go for me is that the language is not red/blue. [1] This enables I/O interfaces to be truly universal, covering just about everything from files on disk, to pipes, to in-memory buffers, to sockets. This feature facilitates a style of, for lack of a better word, generic programming that is hard to come by in other systems. I find basically any other language or platform except Go lacking and unpleasant in this regard, due to the viral nature of asynchronous functions, which never disappears entirely, no matter how much syntactic sugar is sprinkled on top of it. Things like mismatch between event reactors or asynchronous frameworks do not exist in Go. Interfaces Just Work, and the entire ecosystem uses them. [1] http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...
- pacala 7y agoI wish I understood what problems people solve day in and day out such that they need to call IO in the middle of Dijkstra’s algorithm. Most "business logic" ought be pure functions over persistent data structures with no IO other than the occasional logging. At the last possible moment, 5% of the code wires in IO in some boilerplaty way. Is that sufficiently pervasive to worry about it?
- Nitramp 7y ago> I wish I understood what problems people solve day in and day out such that they need to call IO in the middle of Dijkstra’s algorithm. For Dijkstra, imagine a very large graph that cannot fit into memory, where you'll need to go out to disk or network to compute the distance of two nodes (or fetch part of the graph, etc).
- lclarkmichalek 7y agoYes. So much business logic requires IO. Pure business logic is a great dream, but it's a dream.
- jandrewrogers 7y agoI/O, both disk and network, can happen almost anywhere because data doesn't always fit in memory, may be streamed from a remote source, and I/O handling cannot always be deferred indefinitely. A significant part of systems software design is accounting for this reality.
- trpc 7y agoI still get fascinated whenever I see praise of Go in some online article. I should give credit to Go(ogle) authors and hardcore fans for making an ugly mediocre language like Go become mainstream enough to set the norm for next-gen developers. The only pro of this language is that it's a very easy to learn compiled language. Nothing else. It's not until you deal with a large codebase that you understand how ugly, messy and daunting this language is to a depressing degree.
- dunk010 7y agoSounds like you've had some experience of at least one large codebase in Go. Care to elaborate the sticking points?
- walterbell 7y agoWhat would you recommend as an alternative that would still be accessible to Go-literate developers?
- brodsky 7y agoI think such arrogance is uncalled for, but also it would be interesting to hear your experiences that led you to this conclusion.
- EdwardDiego 7y agoArrogance/PTSD? Hard to tell.
- NateDad 7y agoI worked on a million line go codebase for 3.5 years. It was readable and consistent and actually quite nice.
- layoutIfNeeded 7y ago>a million line Yep. That’s Go for you.
- msla 7y ago
- svat 7y agoI am not a Go programmer, but every time there is a discussion about Go I want to link to the article on “Language Design in the Service of Software Engineering”: https://talks.golang.org/2012/splash.article https://talks.golang.org/2012/splash.article It explains so many of Go's design decisions and why it is the way it is (e.g. why something like gofmt/gofix is among the best things about the language); I wish there were similar articles on the design decisions behind more languages. The first point in this (OP) post is also explained by the same philosophy: as far as Readability / “I can pop open almost any .go file and [can] understand it pretty quick” goes, it is a powerful thing to be able to navigate to pretty much any team's code and not only understand their code but also be able to focus on what's specific to that code rather than on idiosyncratic stylistic differences. In other languages this is done with a lot of adherence to the style guide; if Go tries to make it even easier, this would make sense.
- batty_alex 7y agoTo add to this, I appreciated that C++ had this, too: http://www.stroustrup.com/dne.html http://www.stroustrup.com/dne.html Was very insightful, in the same way your link was.
- owaislone 7y agoAt my current job, most of the backend code is divided in two separate groups. One uses Java while another is built with Go. Both have teams have very good reasons to choose what they did and both languages are serving their purpose pretty well but one of the major issues with the Java team I've seen is how discussion there is around styling the code. Most PRs have some comments about some styling and it gets a bit worse every time a new engineer joins the team. I think what you pointed about Go is one of it's best features if not the best.
- aphexairlines 7y agoThe Java team could use EditorConfig, CheckStyle, FindBugs, ErrorProne, or other tools to enforce team rules similar to how the Go team uses tools like gofmt.
- hu3 7y agoThat's a trend I witnessed first hand while working as dev for a bank. Old Java code slowly being phased out for Go. Which to me seemed like madness at the time due to lack of generics but it turned out to be fine, just needed a different mindset. This often resulted in a much shorter edit-compile-run loop and halved the hardware requirements, specially memory. These days I'm not even surprised when new clients demand Go in my current consulting firm. I think there are "better" languages than Go but they also come with their own tradeoffs and from what I've seen, to many it seems Go is preffered after weighting in.
- wikibob 7y agoThis is interesting. At the Banks was this driven by internal staff, or contractors? I’m considering contracting, any particular banks that you thought were more competent?
- hu3 7y agoIn my case the Go adoption was spearheaded by a team lead from their staff. As for what banks are more competent or dare I say modern, it can vary wildly even in the same bank depending on what piece of software each team works on. From my experience banks are (understandably) resistant to change so you might have a hard time finding greenfield projects there. In general, I'd say go for banks only if you're interested in quick money over career development. It can be soul crushing at times.
- kjs3 7y agoDisclaimer: At a very large US bank. Seconding the assessment. We have pockets of everything from legacy mainframe you've probably never heard of (no, not every mainframe is an IBM) to cutting edge cloud/docker/devops/agile/etc. Just depends on where you can be plugged in.
- isodude 7y agoWhen I was being exposed to functional programming I absolutely loved it. However, when challenged with rewriting non-functional in a functional manner, all hell broke loose. It's not a complete rewrite, it's a completely different mind set. Almost as it's simpler to just start fresh with the problem at hand. I get the same feeling with Go, if you try to copy what you've done in other languages you will be enraged. If you embrace the new mind set, it's nice. Rust is nice, but it's a fresh breath of air to not have a weird syntax to work with but proper words. But maybe I've been too far away from C for too long of a period.
- mooreds 7y agoAh, the sweet smell of language wars in the morning. Seriously, though, I wonder how much of golang adoption is due to it being a shiny new thing relative to Java and how much is due to it actually solving a problem. Bray outlines several areas where golang functionally outperforms Java (deadlocks, truly WORA). I have used golang a bit and found it ok. Because of my background I'd prefer to write code in a dynamic language but I get that there are times when you need to have better performance, and you may want that without the baggage of the JVM.
- dunk010 7y agoI didn't find the article all that convincing. Just a general FOMO smell, and not much substance to back it up. Nothing deep.
- erik_seaberg 7y agoJava is prone to deadlocks because "synchronized" makes locking very easy while proving exclusive ownership is still very hard without help from the language (linear types, unique types, borrow checking). If locking is harder in Go, that just turns some deadlocks into data races and crashes.
- sandGorgon 7y agowhat happens at companies where there a LOT of math. Like fintech, AI, etc companies. Are there equivalents of numpy,pandas, etc for go ? what happens when you need to deploy models ?
- kasey_junk 7y agoYou use something else. Go does well at shuffling bytes. It does ok at shuffling text. Once you leave those domains it starts to get abrasive pretty quick. It turns out lots and lots of systems shuffle bytes & text so golang has a lot of room for adoption but for now modeling, business logic, math etc are all better done in other languages.
- walterbell 7y agoWhat are some language contenders for business logic?
- EdwardDiego 7y agoDefine business logic. You want a rules engine? Java's got them by the bucketload!
- sudhirj 7y agoI’d say Java - most of our stack is in Go, but when it came to a modeling / business rules problem I found it easier to jump to Java 8+ (streams, lambdas), AutoValue for immutable objects, Google Guava for immutable data structures and built in ForkJoin system for easy concurrency and parallelism. It’s super easy to use all cores even when just using streams, which is superb.
- pwm 7y agoAt work for core domain modelling we use Haskell and for service layer code we use Go and Node. They are imho good fits for their respective problem domains.
- 7y ago
- naikrovek 7y agoThe number of Go-haters (for lack of a better term) in here is astounding, to me. If you don't want to see Go in new code, then don't use Go in new code. There's nothing wrong with this point of view, by the way, (even though it confuses me a bit.) If you won't use Go because of its current lack of generics, that's a perfectly valid point! Don't use Go. I don't mind AT ALL. If you don't like Go for whatever reason, then don't use it. Nothing at all wrong with that position. What I am astounded by is the apparent notion in here that "others need to be made aware my position and brought into agreement with me" - not quoting anyone, just trying to cite a feeling MANY of the comments here are giving me. Maybe it's the HN culture to do this, or the culture of comment sections in general, I don't know.
- the_mitsuhiko 7y agoI’m pretty sure the people that say they won’t use go for new code won’t use go for new code. Not sure what your point is. Go (like Rust) is not particularly popular ourside the wider HN/SV community.
- NateDad 7y agoThis is just not true. 2.5 years ago when I was looking for a remote-only go job, I had so many positions to look at, I had to put them in a spreadsheet. None of them were in silicon valley . Many many places are using go here and there. From start ups to big enterprises. It's rarely all they do, but it's pretty common to have some backend in go.
- the_mitsuhiko 7y agoI mean, sure, Go is also used elsewhere but it's at least at the moment still tiny in comparison with other languages.
- hu3 7y agoOther than my own experience, I've seen some data that led me to believe that Go is more pervasive than I previously perceived: Go started out with a share of 8% in 2017 and now it has reached 18%. In addition, the biggest number of developers (13%) chose Go as a language they would like to adopt or migrate to. https://www.jetbrains.com/lp/devecosystem-2019/ https://www.jetbrains.com/lp/devecosystem-2019/ Regardless of variance, I wouldn't call 18% tiny. Specially given the trend: https://jaxenter.com/go-number-one-for-2019-hackerrank-report-155161.html https://jaxenter.com/go-number-one-for-2019-hackerrank-repor...
- S_A_P 7y agoIts interesting to see what languages become the backbone of different industries. Here in Houston, .NET rules, and I have seen a huge shift towards .NET core and cross platform. Im in the middle of a big build out right now, and we have begun building .NET core services that don't use IIS for our service layer.
- pjmlp 7y agoHere in Germany, at enterprise level it is pretty much .NET, Java, C++ and Web, while most mobile apps tend to focus either on mobile Web or hybrid solutions (Xamarin, Ionic, C++ with native views). Everything else are just small campings.
- totalperspectiv 7y agoI'm curious as to the thoughts of people here on C#. It's in the same Java/Go space, and .Net Core serms awesome on Linux.
- WaltPurvis 7y agoMaybe you should turn this into an Ask post. I'm curious too.
- totalperspectiv 7y agoAsk HN: What are your thoughts on C# on Linux? - https://news.ycombinator.com/item?id=20212649 https://news.ycombinator.com/item?id=20212649 Done!
- kitd 7y agoIt’s amazing — amazing I say — how little generics are missed. Ooof. I've just spent about 3 days debugging Go code that was copypasted x N, with minor (incorrect) modifications. Rewriting it with generics would have been about 30-min job and made it much more maintainable in the future.
- lostmyoldone 7y agoYeah, I wish more people would accept that there are clear tradeoffs between different type systems. The tradeoff in Go seems to work reasonably well for services that doesn't want, or need, to handle complex application domain as fluently as concurrency. Essentially it works well for network/systems level code, and anything that looks like that. But for code that is more of an encoding on an application/service domain, the lack if generics hinders reasoning more than it helps. There you have no use for the fancy concurrency stuff, it has to be abstracted away for the domain experts to be able to be productive. There are, usually, also enough code that global readability become less helpful, and unambiguous contracts/types across systems becomes moreso. The latter case is massively helped by any way to enforce contracts over methods and types, as long as refactoring tools can reason over it. Nevertheless I do believe that locally (in methods/functions) a well behaved type inference and IDE tooling is better than extremely verbose type statements that I then make the IDE hide from me! To me these are clearly different scenarios, but apparently not to most people, or these discussions would rarely occur, but we would have discussions about the characteristics of languages making them suitable for any specific task. After all, for every solution there exists a possible language where the solution for a particular problem is part of the language, trivially making it the best language for that problem. Also trivially, there exists a best language for me, personally, to solve any problem. This is the hypothetical language which encodes and compensates for my individual perceptual and cognitive bias. Now, in a large enough enterprise, the most important contracts, and hence generics, might be expressed in the outward facing interfaces, and thus making them mostly redundant in a single service. Sharing implementations becomes less important at this scale, as it creates problems on it own. Hiring and onboarding masses of juniors are commonly a problem here. Hence, except for networking/systems styled solutions, Go might also be well suited for very large organizations with endless hiring needs, and a desire to look more modern.
- tmaly 7y agoI have had much success with Go for the past 5 years. Simplicity is by far the most powerful feature. If I have to hire someone right out of school, they can pickup the language very quickly. If a team member leaves the company, I can still read and understand the code they wrote. Over a long term horizon, the features of Go make it easier to maintain the software written with it.
- endorphone 7y agoThis is the killer feature of Go, and it's what so many who clamor for various features-of-other-languages miss. Go is designed for simplicity. It is easy to write, but more importantly is easy to understand, even far in the future. For a given problem, n programmers will generally coalesce on a small number of possible Go implementations, whereas other languages will often yield n divergent solutions. I've had Go solutions that I built years ago that I can get into and maintain in seconds, even when I hadn't touched Go in months. Go isn't my primary tooling (my life today is mostly Swift), but as a comparison where a language has gone awry I'd point to C# -- as Microsoft has tried to incorporate whatever cool thing every other language has added, C# projects have often turned into write-only projects where the original author barely can grok their code a month later, and everyone shrugs and says "rewrite it" when confronted with another programmer's C# code. Rust is much the same.
- pcwalton 7y agoCan you give an example of Rust incorporating "whatever cool thing every other language has added"? I have never had the experience of Rust code becoming write-only after a month, and I don't know anyone else who has either.
- endorphone 7y agoThat statement was clearly in reference to C#, which evolved from a beautifully concise language to now being a mishmash of every other style of programming (including the abomination that is LINQ). Rust, though, suffers from being too clever, making it a language in which you can make concise, powerful solutions, but it can making grokking the code difficult, inefficient and error prone. This is where our egos step forward and we announce that it's No Problem For Me, but we've all experienced a situation where we've leveraged a powerful language to do some amazing things, and then a month later it is a gruelling, headache inducing experience trying to figure out what is doing what, where, so we announce that we'll just rewrite the whole thing.
- bovermyer 7y agoI use Go to solve problems. I don't solve _all_ problems with Go. It works well enough, and the people I work with can collaborate in it easily enough. I think that sometimes the (younger?) HN/SV crowd forgets that there are a lot of coders out there doing good work that don't need The Penultimate Best Tool. We just need a tool that works.
- ggcdn 7y agoI'm not experienced enough to give a proper critique of go, but I can say that as a non-cs major learning to code, I found go wonderful to work with. Type system is good enough to catch errors and understand code at a glance, yet not overly cumbersome. The language syntax strikes the right balance of verbosity. The only thing I don't like is the way errors are handled.
- lenkite 7y agoProgrammers who write CLI apps/network-services tend to love Go. Programmers who love mutable, imperative programming love Go. Programmers who find the CSP model a natural fit for asynchronous programming love Go. Programmers who want the stdlib to contain what they need for 80% of use-cases love Go. Programmers who love checking `if err != nil` in every statement love Go. Programmers who write re-usable libraries (eventually) come to hate Go. Programmers who leverage Sequences/Streams, immutability and functional programming tend to hate Go. Programmers who prefer exceptions or railway-result types for error handling also tend to hate Go. Programmers who desire tight control over performance and memory management will obviously hate Go. In my personal opinion, the Go language is handicapped to claim simplicity. However, the Go standard library is amazing for productivity. If Go the language, didn't come with its stdlib and wasn't pushed by Google, you wouldn't have so many Go fans.
- adtac 7y ago>Programmers who desire tight control over performance [...] will obviously hate Go. Curious, why do you say that? Go tries very hard to prevent abstracted, hidden costs like (con|de)structors, so performance is quite obvious. Could you explain a bit more? I understand the memory management part.
- apta 7y agoThe golang gc is not tunable, at least compared to the JVM GC for example. It is tuned for latency, not throughput. So, if you're writing high-throughput code, you can't really do much. You can try to write code that reduces allocations, but so can you in Java or C# (even moreso after Java gets value types). Not to mention that the golang gc cannot handle GBs (let alone TBs of heap space) the way the JVM routinely does. The golang runtime cannot devirtualize interface implementations the way the JVM does[1] or .NET does. I'm sure there are more examples to think of. [1] https://youtu.be/lunJmMBkqLo?t=1072 https://youtu.be/lunJmMBkqLo?t=1072
- Thaxll 7y agoGo GC can easily handle GBs of heap, especially if you're careful with pointers.
- fc_barnes 7y agoDaily reminder that coroutines require a context switch.
- peterwwillis 7y agoI'm still super annoyed that the solution to "dynamically resolving dependencies is a PITA" became "just make a monolithic app and pray for no external dependencies/conflicts". Windows figured this out ages ago. You ship DLLs with your app, you keep them in the same directory, and run your app wherever, but update it incrementally. Now your user doesn't need to download a 120MB file every time there is a one-line change. Wrapping this pattern in a ZIP file that can be executed directly (another Windows-ism) basically gives you everything you want from a static app, but adds the ability to inspect and patch components. Why does nobody use this method?
- quickthrower2 7y agoYou can send out binary patches / deltas though?
- tracker1 7y agoI can't help but feel that JS, Go and Rust will really carve out a lot of development that is currently in Java, and eventually a lot of C# as well. Java is a lion's share in corporate dev, and C# is similar, stronger in some regions/industries. JS has already gained some traction via MEAN stack (though not a fan of Angular, and can do without Mongo). Go has started gaining traction, and I feel that once the Async/Await support cements in an LTS release of Rust, it's use will grow substantially as well. Frankly, it's an interesting time to be a developer, and largely the past decade has been far more interesting than my first in software. I also think there's still room for improvement.
- valyala 7y agoGo is awesome programming language, since it is simple, readable and provides good tooling - code verification (vet), code formatting, testing, benchmarking, tracing, race detector, profiling - out of the box. Go encourages writing simple straightforward code without complex abstractions. This improves programmers' productivity, which allows writing raw practical code instead of spending time on theoretical design patterns, inheritance hierarchy, generics, fancy algorithms, monads, "zero-cost" abstractions (with high mental cost), borrow checking, etc. That's why we could write fast time series database in Go from scratch in less than a year - https://github.com/VictoriaMetrics/VictoriaMetrics/ https://github.com/VictoriaMetrics/VictoriaMetrics/ .