I've spent a weekend with this language and I'm not sure what to think of it. It has some greatness, it has some annoyance.
Good: * Automatic formatting * Sane, C-like syntax * Reasonably fast * Compiles to any OS that matters * Emits its own assembly and runtime (i.e. self-bootstrapping) * Built in documentation * Strong typing == easy refactoring
Bad: * Requires needless verbosity(if err := checks, no generics, deserializing json or XML is a pain in the ass that requires you to know in advance what you're gonna get) * Tooling is unnecessarily dumb (GOPATH etc) * Huge binaries (hello world is around 2 meg) * Unnecessarily rude (unused vars are a compile error) * URLs as library imports (i.e. no real package manager ala pip, gem, or cpan) * No library versioning
Ugly: * Google * SJWism runs rampant in the dev communities
I use it for work, I don't like it but I like having my colleagues write go code. It limits the dumb shit you can do. Also generics might be coming in go 2. And vgo adresses a lot of the problems in existing tooling.
Brandon Morales
Go was created to allow cheap pajeets to write code without fucking everything up
Nathan Foster
Maybe someone can answer this for me. I think Golang is abusing the word "interface" to mean things it doesn't mean in other languages.
As I understand it, an interface is a kind of abstract class, or put another way, a list of function signatures that a subclass must implement.
Golang appears to use this as a kind of not-generic generic by shoving data into interfaces, rather than declaring them and using them later.
I.e.
const j := `{"some":"huge json blob I'm not gonna type here"}` i := Interface{} json.unmarshal(j, &i)
I know Go isn't a "true" OO language, but their definition of interfaces appears to match up with how I understand them. What is this unmarshal example doing?
Tyler Garcia
unmarshal will attempt to extract values from the json object into the given type using reflection. Say you have a struct with a field called Foo it'll attempt to extract the field named Foo from the Json object into your object. I'm not good at explaining.
Alexander Ramirez
Also your code won't compile you can't instantiate an interface.
Henry Barnes
Right, I get that, but why would you unmarshal into *an interface*? That seems like the wrong construct for a thing to hold arbitrary data, given that an interface (in other languages) is usually something the programmer defines for other programmers to use.
Luke Peterson
Uh, what? Yes you can. I kinda fucked up the syntax there. Here's something that works:
package main
import ( "fmt" "encoding/json" )
func main() { op := []byte(`{"this is some":"json stuff here"}`) fmt.Println("Hello, playground") var faggot interface{} json.Unmarshal(op, &faggot) }
Colton Diaz
Have you ever considered if you can be replaced by Pajeet no matter the langauge, maybe you're just not worth anything at all? You really expect companies to hire awkward neckbeards to write buggy code all day because they feel superior? Maybe you're more of a brainlet than pajeet
Kevin Harris
the only sane Golang review I saw on Jow Forums, that's what I say here every couple of days but everyone resorts to the pajeet/no generics meme
Mason Kelly
Yep, sorry I was wrong about that. Anyway here's what you need to do in this case package main
import ( "encoding/json" "fmt" )
type Thing struct { Message string `json:"this is some"` }
func main() { op := []byte(`{"this is some":"json stuff here"}`) fmt.Println("Hello, playground") var faggot Thing json.Unmarshal(op, &faggot) fmt.Println(faggot) }
Anyway, an empty interface is anything, in your case faggot is a nil value so Unmarshal does nothing. In this case Unmarshal uses reflection and field tags to determine that "this is some" corresponds to the Message struct field. IDK if this is any clearer. It probably helps to not think in terms of OOP, an interface is just a thing that implements defined methods. Go uses empty interfaces in cases where genericity is required but since the language doesn't implement generics you have to use interfaces and reflection as a workaround
Ryan Anderson
>* Huge binaries (hello world is around 2 meg) Holy shit, is this true?
Angel Fisher
Sort of - no golang program will be smaller than 2 (1.9 if you want to be serious), but they don't get much larger than that.
By stripping the debug symbols and running it through UPX, you can get down to 400K, which is still fucking monstrous for hello world, but much more reasonable.
I wrote a small """penetration testing""" tool that used third party C SDK with it and it was surprisingly easy and pleasurable to use even though I had no previous experience with Go or with interfacing with C from other languages. Goroutines are very well suited for concurrent networking stuff -- I tried doing it in C++ at first but it was a nightmare to get it working (probably because I'm shit at C++ and concurrency but whatever).
Henry Fisher
this itself isn't an issue at all unless you want to create binary that run on embedded systems, which nobody does in case of Golang
John Martin
what does FFI mean?
Caleb Hughes
foreign function interface aka interacting with other languages
Isaiah Morris
Thanks dude this is great. I'm writing a MITM cryptominer right now for my project. Will definitely look at using this
Xavier Clark
It's a language made by a big corporation to enable straight forward implementations of software that doesn't require you to be particularly clever. As a language it's quite boring. It's not too fancy, not too complex. If you already know how to program, you can pickup most of go in just a few days. But beyond the language itself it has all the characteristics that you would like to have if you're a big enterprise. It's stable, people can learn it easily, it's supported by google, has a code of conduct, and is all around simply enterprise ready.
It's ok for what it is, but I don't think it's neither exciting nor a lot of fun.
Ian Johnson
have you been learning go for weekend just to parrot things from every golang thread ever?
Colton Scott
My understanding of Go is that it was designed to give to entry level programmers along with a task, and that the language lacks "advanced" features so that the language itself prevents bad code and you can get functional work out of people with any skill level. Anyone else think the same/otherwise?
Bentley Brown
>* SJWism runs rampant in the dev communities This is the biggest festering problem
Jace Flores
Generics.
Gabriel Kelly
dies it allow manual memory management or am i forced to use the GC always?
Ayden Allen
Add slices to the bad list. They are apparently the language's tool for dynamically resizing, sequential containers but they're awful to use because the only operation is adding items. You remove items by creating a new slice with all items before the item you want to remove and then adding all items after it. VEEERY performant if you want to remove multiple items, with a lambda function. Not. Also implicit interface implementation is retarded. When I look at a class, I want to know which interfaces it implements. It's important. I also want to get an error when I fail to implement an interface, or when the interface changes for some reason and I forgot to change the class.
Go in its current state is pretty bad. They claimed they'd actually listen to the community in Go 2, so we'll see how that's going to turn out.
Cooper Anderson
It was designed to be simple because complexity is shit. Learn into cat-v.
Dominic Bailey
>37879ms >37.9s Oy gevalt
Angel Roberts
Slices are arrays with some more convenience. If you don't understand how to operate performantly on arrays maybe stop programming altogether, you retard.
James Jackson
I know how you're supposed to operate on them. You're supposed to copy-paste shit from github.com/golang/go/wiki/SliceTricks like every developer because it's easy to mistype every operation but append, because Rob Pike didn't think it was necessary to have functions for these common operations. Inserting an element at a position, for example, shouldn't require me to write s = append(s, 0) copy(s[i+1:], s[i:]) s[i] = x
. In No other language is it this retarded.
I know you're going to counter with the generic Jow Forums "hurr durr you're just too stuport to remember I use gentoo I compile everything", but programming languages are tools that are meant to make you productive and let you avoid errors and this bullshit accomplishes neither.
Christian Hernandez
just fucking read the page on how to operate on arrays/slices before spreading FUD removing element from array is indeed ugly but it doesn't use another allocation there is even explicit example how to filter on array in-place, again without additional allocation >I want to know which interfaces it implements use guru, it's really handy tool for all sorts of things >I want to get an error when I fail to implement an interface you get compilation error
Ryan Walker
>* Emits its own assembly how is that a good thing? their assembly is retarded and has 2 forms for no real reason. additionally they already have SSA IR next to it >self-bootstrapping wtf do you mean by that?
Easton Reyes
Where did you find that page?
Adrian Wright
What part about 'slices are arrays' do you not understand? Obviously you will have to copy shit if you want to "insert an element" into an array, you fucking retard. This is how they work. And the language just reminds you of the dumb shit you are currently doing. This is called 'being explicit' about what happens. Which is better. If you need to insert shit inbetween use a list you dumb fuck.
Oliver Torres
>cat-v >suicide because life is too complex for your autism brain
Aaron Price
Programming langauges are about abstraction you fool. We could all open a fucking hex editor and create an x86 executable that way, but nobody does. But why, user?! Isn't that "how da kompootor werks"? Nobody needs to type that shit. It's nice to keep in the back of your head that that's what happens, but there should be a function in the language that does it - just like there's one for appending elements. Also lists have terrible performance, did nobody teach you that? The tiny performance benefit you get from the faster navigation is offset by the massive performance loss you get just by navigating to the node where you want to insert something. Or do anything else with the list. Lists are only useful to implement certain other data structures. ALSO if you use a list, go immediately bites you with its "lol no generics" bullshit. Arrays, maps and slices are at least typed.
Gavin Cruz
this, locales and timestamps nearly made me kms as well
Hunter Gray
I think only google needs it. It makes little to no sense for other people to use it.
Landon Thomas
faggots like you ruined this good post
Evan Harris
What is your problem? We're just having a civilized discussion about language features.
Caleb Howard
Just stop talking. It's obvious you are a noob, just spouting random crap you heard here and there. Want this function to insert something inbetween two halves of an array? just write your own. You already did. So why are you still complaining when it was this easy to do?
If you don't want to use go, then don't use it. But don't complain about random missing features, because nobody cares. It's made for and by people who dislike adding random features. (Because they have realized that feature-creep is one of the most cancerous things in programming today)
The fact that you still think about adding generics means that you haven't understood go at all. How to get go? How about program more and stop posting your dumb opinions.
Cameron Cox
>self-bootstrapping
Go builds Go, it's not built by an intermediate compiler. The language doesn't need any external shit.
Lincoln Morris
The fact that Google is still just a C++/Java/Python company and wont use Go (except for minor utilities) says a lot about why Go isnt taking off. If there is any company that would benefit from Go its Google and their heavy reliance on large scale server software. The problem is that all programmers all taught regular OO and start out making programs that make a cat class inherit from an animal class and give the cat class meuw methods. So when programmers look at module-based OO they just cant understand it. The ONLY way Go will ever take off is if Rob Pike starts training staff to convert C++/Java to Go so that programmers will see that modules organize code in a clear and understandable way just as much as classes can.
James Cooper
>The fact that Google is still just a C++/Java/Python company and wont use Go (except for minor utilities) says a lot about why Go isnt taking off
Even though is the most retarded language I've seen, the real reason is that very big projects cannot be simply rewritten to a superior language just for the sake of it, it's very hard and daunting to rewrite any big project
but if they would start a new project, they would probably choose different language, architecture, etc...
Josiah Cooper
it used to be written in standard C which made it fucking gloriously portable to all sorts of OSs then they ported the source tree to Go, crippled compile times to double and had to preserve backward compatibility for 5 major versions to keep the C debootstrapper alive it's decision with compromises, not an advantage
Luke Parker
>SJWism runs rampant in the dev communities
I disagree fringe views rarely make it to anything related to go, maybe some of the devs do feel that way but they keep it out of the language or documentation and most certainly don't bring it to the forefront. (see rust)
As for go I've used it for about a year and its language I use the most now. (I come from a mostly python world) A lot of the native tooling is just awesome as well like pprof. I can't really say why I like using it so much its not really one thing just a lot of different reasons.
Some of the shitty sides of golang, it basically sucks for scientific computing with multi-d arrays, and a lot of libraries that are heavily optimized in python are much much better.
Leo Rogers
>and a lot of libraries that are heavily optimized in python are much much better Python libraries are optimized because they are implemented in other languages, ie Fortran, C++
>I'm not sure what to think of it then don't think
Joshua Murphy
Ive never seen so much try-hard FUD, pretending great features are bad
I wow, I really want generics (C++ templates), that will fix everything
Austin Wright
I spent one day trying to build a library that has to work with cgo on windows. Apparently you need the tdm gcc version, msys and cygwin don't work and even with tdm I couldn't build the damn thing.
Michael Murphy
The fuck are you even trying to say in your second sentence Nice reddo spacing btw
Gabriel Williams
Pretty good post.
Gabriel Murphy
Im saying this entire thread is a FUD thread against Go and I think its funny that C++ shills actually think that they can criticize Go for not being built with templates like theyre actually going to convince people to turn Go into a template shithole like C++
Aaron Ortiz
>* Sane, C-like syntax Not sure about that, but convince me
>Computer languages are nearly all the same except from syntax wut kind of retardhead wrote this tons and tons of older languages had type after name it's more readable, simpler for defining grammar and way more flexible for type interference (auto keyword is stupid idea) >the most advanced form of programming is called OO ok it all makes sense now
Mason Morris
>Yes you can. I kinda fucked up the syntax there. No you can't. Interfaces are not concrete types. You can declare a variable with an interface type, you cannot instantiate or create an interface "value".
Your problem is you have a half-assed understanding of type theory, likely from Java, and trying to understand Go by forcing it into your understanding of Java.
Variables have types and values have types and those are not the same. The type of a variable determines what you can do with that variable and the type of the value determines what types of variables you can store that type into. Interfaces are variable types that allow you to call certain methods.
var x Foo x = y
If Foo has a Foo method, you can only call the Foo method, even if y has a Bar method.
If you declare a variable as an empty interface, you can store any type of value in it, but you can't do anything with it because the interface defines no methods. You have to convert it to a type that does have methods.
Liam Wright
Type system is as bad as original Java. Annoying compiler that aborts if you have any unused variables or imports, with no way to disable this behavior. There's a huge focus on concurrency, but in practice it's just green threads with a small amount of syntactic sugar and a built-in thread safe queue type. Design is based around being easy to use for recent CS graduates.
Google explicitly agrees with you. >Programmers working at Google are early in their careers and are most familiar with procedural languages, particularly from the C family. The need to get programmers productive quickly in a new language means that the language cannot be too radical. talks.golang.org/2012/splash.article
>If you need to insert shit inbetween use a list you dumb fuck. Implementing a abstract data structure in Go is a lot of effort.
Austin Moore
I'm glad Go doesn't have generics in a sense, because most people just want them to play AbstractBeanFactoryFactory games and design horrible OOP class hierarchies that make medieval family trees look simple.
Asher Rodriguez
>slices are arrays No, slices are go's equivalent to C++ vector or c#List. They use arrays internally, but aren't pure arrays you dumb fuck.
Carter Cook
No, slices are literally just a pointer to an array, the length of the slice, and the length of the allocated array.
Liam Myers
>* Reasonably fast kek
Isaac Kelly
It's already portable to all OSes and architectures that matter.
android arm darwin 386 darwin amd64 darwin arm darwin arm64 dragonfly amd64 freebsd 386 freebsd amd64 freebsd arm linux 386 linux amd64 linux arm linux arm64 linux ppc64 linux ppc64le linux mips linux mipsle linux mips64 linux mips64le netbsd 386 netbsd amd64 netbsd arm openbsd 386 openbsd amd64 openbsd arm plan9 386 plan9 amd64 solaris amd64 windows 386 windows amd64
Gabriel Barnes
>Annoying compiler that aborts if you have any unused variables or imports, with no way to disable this behavior.
Almost like that was mentioned in the OP.
>No you can't. Interfaces are not concrete types. You can declare a variable with an interface type, you cannot instantiate or create an interface "value".
I'm not sure what the substantial difference is there. In either case, the system has allocated memory and a pointer to that memory for the interface/object/thing.
Also, I fucking hate java.
Noah Long
Let's be honest, most people want it so they don't have to needlessly repeat themselves.
Christopher Walker
>No you can't. Interfaces are not concrete types. You can declare a variable with an interface type, you cannot instantiate or create an interface "value". This is why Go is the language of the future, you are not constrained by static class types, this makes Go a more dynamic language to deal with dynamic web-based generated data. This is why you dont waste your career learning 'patterns' to try and mold static class types to deal with dynamic data
Zachary Anderson
Can't tell if 'avin a giggle or retarded, but you realize dealing with anything dynamic in Go is a pain in the ass, right? You either have to define a struct ahead of time to shove the data in, or shove it all into an interface and then write a litany of fucking case statements to choose the right type for the data.
Go can be more bureaucratic than Java in some ways.
Hunter Taylor
youre trying real hard to make Go look bad by comparing it with Java, Im having a giggle alright, keep it up
Dylan Barnes
The reason why GO isn't used as much is because it being good for large scale distributed systems is a fucking meme and Java curbstomps it at its purpose
Michael Edwards
Deserializing a json blob in Go is a tedious waste of time, moreso if that json blob doesn't have a well-defined layout that maps nicely to a struct.
Luke Long
yes thanks to that C debootstrapper compiler devs still need to make sure the newer versions of language can be compiler with a version from an year ago and nobody likes dealing with backward portability beside that you need different 2 sets of patches to make the compiler work on those architectures, it's pain in the ass to make go run on 9front and it breaks every other version
Aaron Butler
It gets compared to java because it essentially IS java, pre-generics. It's shit.
Dominic Cooper
>likely from Java, and trying to understand Go by forcing it into your understanding of Java What you're describing is pretty much exactly how it works in Java as well.
Easton Anderson
>It gets compared to java because it essentially IS java, pre-generics. It's shit. you so funny, its shit because it doesnt have templates like C++, thats the only 'bad' thing you can come up with
Henry Jenkins
There's a reason most of the civilized world moved to exceptions rather than checking errors inline. Repetition and boilerplate does not make for expressive and readable code.
Bentley Clark
>There's a reason most of the civilized world moved to exceptions Id like to see you in a room full of professional programmers and say that with a straight face
Jason Long
I'll give you an example. Say you have a struct with 5 or 6 functions that have it as a receiver. That's 5 or 6 (or more) times you get to write
Where over in the world of non-poojeets, I could just raise a goddamn exception for my class and handle it all in one place.
Matthew Edwards
>Id like to see you in a room full of professional programmers and say that with a straight face I'd like to see you kill yourself, but sadly we can't all get what we want.
The top 5 most popular programming languages in the world by Github stats are:
PYTHON JAVA RUBY PHP C++
Coincidentally, every single one of them uses exceptions.
William Gutierrez
Most Java programmers don't understand Java's type system either.
Justin Perry
>I could just raise a goddamn exception for my class and handle it all in one place. try { main() } catch (Exception e) { // Stop errors }
Asher Williams
>muh lemming mentality >everyone does it so should I
Sebastian Cruz
>implying pokemon exception handling is an accepted or normal method of programming rather than a pathological use case even poos know better than to use
Jaxson Smith
>most programmers do $thing >I should ignore $thing entirely because I'm smarter than all of them
esr pls go and stay go
Carson Jackson
If you actually handled your errors properly you'd realize that it ends up even more verbose than Go's error handling.
Jack Rivera
Often "handling the error" means stopping what you're doing and telling the user.
Kayden Martin
Can't let them see I lost so hard REEEEEEEEE
Dominic Taylor
Yeah, I want to use it, but frankly it'll take longer to do the same thing in Go than it would to just use Python. I have very few use cases aside from tooling that would need to be portable.
It doesn't help that the one thing I work with most of the day there's no production ready and stable framework for. There's tons of mostly incomplete libraries for it, or libraries that are missing the stuff I actually need so it makes it even less appealing to work with if I'd have to implement all the logic that exists in the Python library myself.
Go lets me write code that is compilable and can run on all of the OS's that I need to use at work. It's super useful for making things that your colleagues can use. You just go build source.go and hand your coworker the binary with a manual. No dependencies or library installations required