Questions tagged [go]

Go, also called golang, is an open source programming language initially developed at Google. It is a statically-typed language with syntax loosely derived from that of C, adding automatic memory management, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library.

Go is a general-purpose language designed with systems programming in mind. While created by Google employees, including Ken Thompson, Rob Pike and Robert Griesemer, Go is an open source project with a large contributor base outside of Google. It is aimed to be efficient both for development and execution with a focus on fast compilation and increasing the maintainability of large projects. Go was originally targeted at systems programming tasks such as building server/web applications, high throughput middle-ware and databases. Go has a growing ecosystem of libraries allowing it to be used for a wide variety of tasks such as developing end-user daemons, CLIs and desktop applications.

Go is expressive, concise, clean, and efficient. Its first class concurrency mechanisms make it easy to write programs that get the most out of multi-core and networked machines, while its structural type system enables flexible and modular program construction. Go compiles quickly to memory safe machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that develops like a dynamically typed, interpreted language, but performs like native code.

There are now several Go programs deployed in production inside and outside Google, as well as being supported directly by Google App Engine.

On March 28, 2012, The Go team released version 1.0, along with binary distributions.

The latest version is 1.4 released on December 10, 2014.

Go Tutorials

Go Books

Free Go Books

Go projects

Go Reference Documentation

Go official mailing lists

Go IRC channel

Online Go Compilers

Videos

FAQ

145 questions
83
votes
2 answers

Why is there a "new" in Go?

I'm still puzzled as why we have new in Go. When you want to instantiate a struct, you do t := Thing{} and you can get a pointer to a new instance by doing t := &Thing{} But there's also this possibility : t := new(Thing) This last one seems a…
58
votes
12 answers

What are the chances of Google's Go becoming a mainstream language?

Who here is learning Go? Are other companies looking at using it? Is it likely to become widely used?
interstar
  • 1,449
36
votes
3 answers

Is having source code for a Go project outside GOPATH a bad idea

I am working on a new project using Go, and we are all new to Go. We are following the standard go directory structure, and having all code under $GOPATH/src/github.com/companyname/projectname which is also the root of a git repository The…
Pete
  • 8,956
  • 3
  • 42
  • 53
9
votes
3 answers

Why does Go have a special case for abs(0)

I was playing around with Go, and found this particular interesting code for the abs function in the math package: http://golang.org/src/pkg/math/abs.go 14 func abs(x float64) float64 { 15 switch { 16 case x < 0: 17 return -x 18 …
user84386
  • 107
4
votes
1 answer

When does structural typing's flexibility provide an advantage over nominal typing?

I'm trying to understand the implications of structural typing vs. nominal typing. From reading, I've managed to gather that one of the key advantages of nominal typing is the ability to declare an interface that can be used with third party…
Casebash
  • 7,662
4
votes
2 answers

What are the prerequisites for learning Go

I am considering learning Go. As far as I know about it, it's a systems language geared toward parallel programming. (correct me if I'm wrong) Should I have a very good understanding of C in order to be good Go programmer? How much systems concepts…
treecoder
  • 9,495
3
votes
1 answer

Generic-type operations must by provided by the run-time. Why this is a weakness of Go?

So, reading golang blog on slices there is a snippet by Rob Pike A weakness of Go is that any generic-type operations must be provided by the run-time. which I don't quite understand. Can one rephrase same sentence? Considering the context before…
Nemoden
  • 163
3
votes
1 answer

directory layout of a Go-lang project?

I'm just discovering the Go programming language. (FWIW, I am fluent in C++, Ocaml, C, Common Lisp, Scheme, I know well Linux, and I have designed & implemented GCC MELT; I am considering a rewrite of some MELT monitor in Go, but have not decided…
0
votes
4 answers

Should Golang 'private' methods need unit tests?

I'm relatively new to Go but I come from a C#/OOP background where unit testing private methods isn't something that's generally done. I currently have a senior developer telling me it's "bad design" if private package methods can't be tested. Is…
0
votes
1 answer

Preferred return type, pointer or value, when the method/function can also return an error

In Go we can choose to make something a pointer or not. We can also support multiple return types. A common signature on functions or methods is: type MyType struct{} // Value Return Type func (m MyType) FindOne(key string)(MyType, error) {...} //…