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 ...

learn more… | top users | synonyms

2
votes
2answers
109 views

Restful User/Password Authentication

I'm currently designing a REST-API with the following properties: Backend for a single page application (Later Apps) Integrated user database for each instance HTTPS/TLS only Authentication with ...
1
vote
0answers
57 views

Why was Go list iteration designed with the index before the element? [closed]

When iterating over an array or slice in Go you can use the range keyword. for idx, e := range someSlice { } Here, the idx represents the current index and the e the current element in the array. ...
2
votes
0answers
39 views

Go - idioms/design for determining when an unknown number of goroutines are complete

I have a workflow wherein I walk recursively through a bunch of directories, then for each file perform some action. I'm using goroutines to walk each directory, and also to process each file. The ...
0
votes
1answer
53 views

What locking mechanism should be used when persisting data to files

I am beginning to learn how to create web applications from a golang tutorial. For simplicity, it persists data to files instead of a database. The complete code creates a server that can handle ...
0
votes
2answers
146 views

Nested functions; allow or not? [closed]

Having programmed a whole lot in python, using nested functions is a good way to not clutter the namespace with small helper functions that are only used once. Now I'm programming in go, and upon ...
0
votes
3answers
108 views

Would it be possible to create a language similar to Ruby/Python with static typing that had the speed/memory usage of a compiled C program? [closed]

One of the main drawbacks of Ruby/Python is performance. I understand that they are interpreted and C is compiled. (And there are things like JRuby which do JIT compilation with Ruby). But they never ...
1
vote
1answer
72 views

Single import in a large file vs. multiple imports in smaller files. [Golang]

I'm sure the folks at Google worked long and hard to ensure the programmer wouldn't have to worry about details like this, but I'm curious. In Go if I have multiple files in the same package, but ...
1
vote
1answer
122 views

Does Go implicitly discourage getters and setters and encourage direct member access?

As the title says, is accessing public struct fields more idiomatic in Go than getters and setters? Wouldn't that lead to violation of data encapsulation, also public fields in other OO languages like ...
2
votes
1answer
404 views

How should I handle database failures in a web application? [duplicate]

I'm developing a simple RESTful API using Go's Goji framework (although this question is language-agnostic), in which parameters from the URL are queried against a PostgreSQL database. Here's how it ...
1
vote
3answers
169 views

Are project naming conventions more important than language naming conventions? [closed]

I'm working on a project with a senior developer and he doesn't really abide by the naming conventions of the language that we're using. The project is in Go and he uses underscores for everything. ...
1
vote
1answer
73 views

What is the difference between embedding and composing?

What is the difference between go's type embedding and object composition? My understanding is that type embedding is object composition except the methods of the embedded type are automatically ...
3
votes
2answers
480 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 ...
2
votes
2answers
396 views

How would I allow a PHP front end to communicate with a back end written in Go (or any other combination of languages)?

I like PHP. It's not overly complex to achieve what you want, you can write straight up HTML inside it, and I suppose I'm just used to it. I also like Go, having just discovered it while looking for ...
2
votes
1answer
51 views

I have an unordered list of rectangles and their neighbors on four sides with no origin. How can I efficiently convert this into a grid?

I am writing a GtkGrid-like container for my GUI library for Go, and I'm trying to write the actual layout part of the code. Basically, I have an unordered list of controls. Each control is a ...
5
votes
2answers
1k views

Type inference in Golang/Haskell

I've read that Go doesn't actually have true type inference in the sense that functional languages such as ML or Haskell have, but I haven't been able to find a simple to understand comparison of the ...
21
votes
1answer
4k 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 ...
2
votes
2answers
207 views

Does a vm implemented in garbage collected language need a garbage collector?

This is more of a theoretical question. If jvm is implemented in go which itself is a garbage collected language, then does that jvm need a separate garbage collector to be implemented for its own ...
1
vote
2answers
308 views

Go-like interfaces + multi-methods make sense?

Thinking about the design of a potential new language, I wonder how related are the concepts of built a OO similar to GO interfaces and multi-methods (I get this from ...
3
votes
2answers
621 views

Why do concurrent languages tend to have more complicated syntax?

This is a question that's been on my mind for a while. Recently I've been checking out concurrent languages like Haskell or Go or Erlang. From my point of view, they have huge benefit in performance ...
2
votes
3answers
2k views

What are the advantages of pass by value?

I always thought pass by value is a legacy from the early languages, because the designers had never seen anything else. But after seeing the brand new languages like Go adapting the same principle ...
18
votes
1answer
5k 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 ...
-1
votes
1answer
366 views

Could ChromiumOS be re-written in Go from the ground up? [closed]

As Go seems able to performance match C and with Google obviously biased towards Go, I feel that it would be great way for Go to gain more traction. The way ChromiumOS/Chrome has jumped from an ...
3
votes
1answer
465 views

What do goroutines, Ruby Fibers, etc. look like to the OS/Kernel?

In process concurrency and thread concurrency it's quite obvious how the kernel sees these as they map directly to real things that the kernel manages. When it comes to Golang goroutines and Ruby ...
18
votes
2answers
2k 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, obviously, you can get a pointer to a new instance by doing t := &Thing{} But ...
10
votes
1answer
3k 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 ...
1
vote
1answer
203 views

“A line comment acts like a newline”

I'm reading the Go language specification. The section on comments states: Line comments start with the character sequence // and stop at the end of the line. A line comment acts like a newline. ...
5
votes
2answers
784 views

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 ...
13
votes
1answer
2k 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 ...
5
votes
3answers
471 views

Performance considerations when using Go for my project

I'm looking at using Go (aka golang) for a project (a SQL database, but that mostly doesn't matter here) where performance is critical, but under low load the primary bottleneck will be I/O to disk. ...
2
votes
2answers
2k views

clojure/erlang/go for high volume server

I have a project that will need to handle 1000s of requests a second with a decent amount of processing for each. For the most part, the processing will be done on a list of items, basically ...
8
votes
2answers
414 views

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 ...
1
vote
3answers
414 views

What can Go chan do that a list cannot?

I want to know in which situation Go chan makes code much simpler than using list or queue or array that is usually available in all languages. As it was stated by Rob Pike in one of his speeches ...
29
votes
8answers
3k 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 ...
8
votes
1answer
468 views

Math library methods in Google's Go Programming Language

I have been programming in google Golang and have been enjoying it due to its brevity but I find it surprising that almost all its Math standard library methods are for the floating point type. Is ...
20
votes
2answers
16k 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?
3
votes
1answer
2k views

Container types in Golang

For a non-OOP language like google Go, is it idiomatic to go about implementing new container types using datatypes like arrays or lists so as to implement convenient functionality like contains ...
6
votes
1answer
274 views

Optimizing hash lookup & memory performance in Go

As an exercise, I'm implementing HashLife in Go. In brief, HashLife works by memoizing nodes in a quadtree so that once a given node's value in the future has been calculated, it can just be looked ...
3
votes
2answers
1k views

What degree of low-level programming can be achieved with Languages like Go?

Go and D provide garbage collection, and yet they claim to be system programming languages. What degree of low-level programming can be achieved with languages having garbage collection? For ...
14
votes
6answers
793 views

How to search for information related to Go programming language?

If there's something that would kill Go language, then it's name. I find it very hard to find anything in web related just by using "Go" in the query. The word is on of the most frequent in English. ...
11
votes
2answers
2k views

When Rob Pike says “Go is about composition”, what exactly does he mean? [closed]

From Less is Exponentially More If C++ and Java are about type hierarchies and the taxonomy of types, Go is about composition.
4
votes
2answers
2k views

Equivalent of Domain Driven Design for functional programming languages

I really love the idea of domain driven design, however, as I'm learning Go, I'm wondering if there's the equivalent of DDD that's aimed at an effectively more functional language?
10
votes
1answer
4k views

Why did Golang discontinue the “netchan” package?

The Golang "netchan" package seems to have been discontinued. That makes me think that the concept of "networked channels" were not a good practice after all. (Why wouldn't them just "let it be" ...
10
votes
5answers
2k views

Benefits of classic OOP over Go-like language

I've been thinking a lot about language design and what elements would be necessary for an "ideal" programming language, and studying Google's Go has led me to question a lot of otherwise common ...
0
votes
1answer
126 views

Go/Obj-C style interfaces with ability to extend compiled objects after initial release

I have a conceptual model for an object system which involves combining Go/Obj-C interfaces/protocols with being able to add virtual methods from any unit, not just the one which defines a class. The ...
6
votes
2answers
238 views

Language that can statically ensure a map's fields are present

If data is simple and objects are complex, I'm curious if there are any existing statically typed languages that would be able to augment(?) a map type into a type with guaranteed fields. I realize ...
1
vote
2answers
2k views

Equivalent of #map in ruby in golang

I'm playing with Go and run into something I'm unable to find in Google, although there is certainly something that exists: I'm using the following struct: type Syntax struct { name string ...
8
votes
2answers
795 views

What is the name for the programming paradigm characterized by Go?

I'm intrigued by the way Go abandons class hierarchies and seems to completely abandon the notion of class in the typical object oriented sense. Also, I'm amazed at the way interfaces can be defined ...
9
votes
4answers
4k views

GO instead of C/C++ with cgo

Is it possible to replace C and C++ with Go + cgo and interface frameworks such as Qt or DirectX with Go? Any potential pitfalls I should be aware of? UPDATE: I see that my question was not precise ...
17
votes
3answers
1k views

Advantages of a left to right language syntax

I've been watching an interview with Herb Sutter on Channel9 and he mentioned at the end of the video that left to right language syntax would be on the top on his whishlist for a future C++ ...
27
votes
3answers
10k 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 ...