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.
175 questions
91
votes
1
answer
25k
views
How are Rust Traits different from Go Interfaces?
I am relatively familiar with Go, having written a number of small programs in it. Rust, of course, I am less familiar with but keeping an eye on.
Having recently read http://yager.io/programming/go....
84
votes
2
answers
22k
views
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 ...
77
votes
3
answers
70k
views
Sets Data Structure in Golang
I really like google golang but could some one explain what the rationale is for the implementors having left out a basic data structure such as sets from the standard library?
67
votes
9
answers
9k
views
Why do "checked exceptions", i.e., "value-or-error return values", work well in Rust and Go but not in Java?
Java has "checked exceptions", which force the caller of the method to either handle an exception or to rethrow it, e.g.
// requires ParseException to be handled or rethrown
int i = ...
63
votes
10
answers
26k
views
Does it ever make sense to use more concurrent processes than processor cores?
I've got some process in Go. Here's an example counting lines in text, though the question is meant to be far more general than this particular example:
func lineCount(s string) int {
count := 0
...
63
votes
1
answer
32k
views
Are go-langs goroutine pools just green threads?
The commentator here offers the following criticism of green threads:
I was initially sold on the N:M model as a means of having event driven programming without the callback hell. You can write code ...
58
votes
12
answers
7k
views
What are the chances of Google's Go becoming a mainstream language? [closed]
Who here is learning Go? Are other companies looking at using it? Is it likely to become widely used?
39
votes
4
answers
17k
views
How fast can Go go?
Go is one of the few languages that are supposed to run 'close to the metal', i. e. it's compiled, statically typed and executes code natively, without a VM. This should give it a speed advantage over ...
36
votes
8
answers
7k
views
When would you need "hundreds of thousands" of threads?
Erlang, Go, and Rust all claim in one way or another that they support concurrent programming with cheap "threads"/coroutines. The Go FAQ states:
It is practical to create hundreds of thousands of ...
36
votes
3
answers
14k
views
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 ...
35
votes
4
answers
6k
views
How much is Google investing in the Go language? [closed]
I have read quite a bit about the Go language, and it seems promising. The last important bit of information I am missing before I decide on spending more effort on the language is: How much money/man ...
24
votes
1
answer
5k
views
How does Go improve productivity with "implicit" interfaces, and how does that compare with C#'s notion of Extension Methods?
In the Go Language Tutorial, they explain how interfaces work:
Go does not have classes. However, you can define methods on struct types. The method receiver appears in its own argument list between ...
22
votes
5
answers
11k
views
Is a common library a good idea?
I've always thought that a "common library" was a good idea. By that I mean a library that contains the common functionality that is often needed by a few different applications. It results in less ...
22
votes
1
answer
3k
views
Could Hindley-Milner inference work for the Go language?
I've read that Hindley-Milner does not work with type systems that have subclasses, and there are other type system features that also do not work well with it. Go currently has only very limited type ...
19
votes
1
answer
6k
views
Erlang and Go concurrent programming, objective differences between CSP and Actors?
I was looking into concurrent programming in Erlang and Go programming languages. As per my finding they are used Actor model and CSP respectively.
But still I am confused with what are the objective ...