eclipse-scala-go

eclipse-scala-go


5 answers

golang: slice of struct != slice of interface it implements?

Disclaimer: I'm a Go noob, hacking away while learning. Any advice is appreciated, but only if accompanied with code examples :-) I have an interface Model, which is implemented by struct Person. To ...

5 answers | 5 mins ago by Jon L. on Stack Overflow stackoverflow.com
3 answers

GO: Type assertion from list

I have stored a set of strings in a list. I iterate through the list to compare with the string "[the]". When I use the function strings.EqualFold , it presents this error , Cannot use e.Value ...

3 answers | 17 mins ago by user3460885 on Stack Overflow stackoverflow.com
1 answer

Reversing a Subrouter in Gorilla / Mux

I would like to get the path for a named subroute but my code below does not work. When I try to use the same logic on a non-subroute, it works fine. How do I get the path of a named subroute? ...

1 answers | 30 mins ago by Ecognium on Stack Overflow stackoverflow.com
4 answers

Select on a go send and receive channel at the same time

Suppose I have a buffered send and unbuffered receive channel: s := make(chan<- int, 5) r := make(<-chan int) Is it possible to select on them both, so that r will be selected if it has ...

4 answers | 2 hours ago by Timmmm on Stack Overflow stackoverflow.com
4 answers

How to make config file in golang elegantly?

I'm a newbie with go lang, I just want to write a program to manager my redis instances so that i can create a redis with specific config file, but I don't know how to create the config file for ...

4 answers | 2 hours ago by Shanicky_C on Stack Overflow stackoverflow.com
0 answers

How to translate Python waitpid(-1, 0) call to Golang

I'm trying to translate simple Python program to Golang but I hit a brick wall with few function calls that I cannot find equivalents for in Golang os.waitpid(-1, 0) // Python (the original Python ...

2 answers

How end of the statement is detected in Go lexer?

I don't know Go, I am just studying various languages syntax. From Go FAQ: "Go borrows a trick from BCPL: the semicolons that separate statements are in the formal grammar but are injected ...

2 answers | 6 hours ago by greenoldman on Stack Overflow stackoverflow.com
1 answer

implementing Reader interface

I understand the general concept of go's interfaces however I was recently looking into implementing the io.Reader interface and it has me confused. I found this post which didn't help to much. ...

1 answers | 9 hours ago by mschuett on Stack Overflow stackoverflow.com
3 answers

How do you clear a slice in Go?

What is the appropriate way to clear a slice in Go? Here's what I've found in the go forums: // test.go package main import ( "fmt" ) func main() { letters := []string{"a", "b", "c", "d"} ...

3 answers | 10 hours ago by Chris Weber on Stack Overflow stackoverflow.com
2 answers

Slices in Go: why does it allow appending more than the capacity allows?

The capacity parameter in making a slice in Go does not make much sense to me. For example, aSlice := make([]int, 2, 2) //a new slice with length and cap both set to 2 aSlice = append(aSlice, 1, 2, ...

2 answers | 10 hours ago by TonyGW on Stack Overflow stackoverflow.com
2 answers

Why do I need a semicolon here?

Here is a test Go program: package main import fmt "fmt" func main () { ex := "moo cow\n"; fmt.Print (ex) } With the semicolon, it compiles. However, if the semicolon is removed, it ...

2 answers | 10 hours ago by user181548 on Stack Overflow stackoverflow.com
1 answer

How to list installed go packages

To my knowledge go distribution comes with some sort of package manager. After go 1.4.1 installation I've run go help in order to find any sub-command capable of listing locally installed go packages, ...

1 answers | 12 hours ago by sof on Stack Overflow stackoverflow.com
2 answers

Golang io/ioutil NopCloser

Does anyone have a good or any explanation of Golang's NopCloser function? I looked around but failed to find anything beyond Golang's main doc's explanation of: NopCloser returns a ReadCloser with a ...

2 answers | 12 hours ago by G4143 on Stack Overflow stackoverflow.com
3 answers

Is there idiomatic scoped sematics in golang?

I wonder if there is any idiomatic way to represent scoped sematics. By scoped I mean things like: scoped mutex (oneliner instead of explicit Lock + deffered Unlock), logging function (or any code ...

3 answers | 13 hours ago by Kokos on Stack Overflow stackoverflow.com
0 answers

golang: building REST api with revel framework

I'm trying to build a mobile application that'll require REST API. For the REST part, I'm choosing go. I did some googling and found the revel framework. Following the tutorial which builds an app MVC ...

2 answers

Golang reverse proxy with multiple apps

I to want serve two or more web applications running in a VM (different ports and some time in different directory under the same port) from the host machine and because I need the user to be logged ...

2 answers | 20 hours ago by Amine on Stack Overflow stackoverflow.com
5 answers

Unmarshal an ISO-8859-1 XML input in Go

When your XML input isn't encoded in UTF-8, the Unmarshal function of the xml package seems to require a CharsetReader. Where do you find such a thing ?

5 answers | 21 hours ago by dystroy on Stack Overflow stackoverflow.com
3 answers

Does the language Go have function/method overloading?

I'm porting C library to Go language. C function (with varargs) is defined like this curl_easy_setopt(CURL *curl, CURLoption option, ...); So I created wrapper C functions: ...

3 answers | 21 hours ago by Darius Kucinskas on Stack Overflow stackoverflow.com
1 answer

gox - throws error for sqlite3 and all the builds are failed

I have Go application pravasan and in my deploy branch I am trying to execute gox to build its binaries, I am getting couple of errors and they are 18 errors occurred: --> linux/amd64 error: exit ...

1 answers | 22 hours ago by Kishore Vaishnav on Stack Overflow stackoverflow.com
1 answer

Go path and setup

I installed go binary for windows 64 and set up Go Paths like I also downloaded it from git. Why wont it find the go command?

1 answers | 22 hours ago by Jay Hall on Stack Overflow stackoverflow.com
0 answers

Golang zero copy http request

I was wondering if there is a way for the http.client in the standard library to do zero copy downloads. In my case Im downloading fairly large binary data and I rather not have it buffered. Is that ...

1 answer

Read xz files in go

How can I read xz files in a go program? When I try to read them using lzma, I get an error in lzma header error.

1 answers | yesterday by phihag on Stack Overflow stackoverflow.com
1 answer

text/template: space in map's key

I have the following code (using text/template): inventory := map[string]string{"name of the movie": "hello"} tmpl, err := template.New("test").Parse("Movie name ") // I want to display "hello" there ...

1 answers | yesterday by Julien Fouilhé on Stack Overflow stackoverflow.com
1 answer

Error passing map to a function in imported Golang package

I need to send a map to a function declared in a imported package, and keep getting this error: ./main.go:21: cannot use m (type map[string]ticket) as type map[string]some_package.ticket in ...

1 answers | yesterday by kingSlayer on Stack Overflow stackoverflow.com
2 answers

Organizing Environment Variables Golang

In Node.js I use the nconf module to house environment variables like S3 keys, GCM keys, etc for each of my projects. I haven't been able to find a similar solution in Go. What are the generally ...

2 answers

Passing a query parameter to the GO LANg HTTP request handler using the MUX package

I am trying to pass an additional parameter in the request I am trying to send to the GO server - websocket.create_connection("ws://<ip>:port/x/y?token="qwerty") The GO lang server ...

2 answers | yesterday by psbits on Stack Overflow stackoverflow.com
2 answers

How to minimize the garbage collection in Go?

Some times you could want to avoid/minimize the garbage collector, so I want to be sure about how to do it. I think that the next one is correct: Declare variables at the beginning of the function. ...

3 answers

Testing lists in GO

I'm trying to implement a test in GO. But I'm struggling with the list's syntax inside the struct. package primeFactor import "testing" var testCases = []struct { p int expected ...

0 answers

How many connections are created and reused by Golang

Anybody knows how can I test the numbers of connections that transport is currently creating on the pool of the connections, it is clear that in the code I have put MaxIdleConnsPerHost: 5 like number ...

1 answer

Rebuild when files changes on docker

i'm starting to work with docker (with boot2docker on Mac OSX) and golang, Whenever I make changes on my .go files I want to be visible on the docker image. Is there anyway to do this? Or docker is ...

15 30 50 per page
1 2 3