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) }