3 answers

How can I print to Stderr in Go without using log

How can I write a message to Stderr without using log? A comment in this SO post shows how to do it with log: log.Println("Message"), but what if I don't want a timestamp? Is the following good Go? ...

3 answers | 23 mins ago by mheiber on Stack Overflow
2 answers

Concurrent send/receive go channel

I have a go channel called queue with let's say 100 as the buffer size. Many go routines can send data to this channel, and another go routine is sitting there to receive data from this channel. This ...

1 answer

Nilable value in appengine/datastore using Go

The list of supported types by datastore doesn't contain pointer types ( How then can I represent a value that can and sometimes should ...

1 answer

Variable not visible in partial

Why is the title attribute of my page object not populated in the header template ? here is my small go program package main import ( "html/template" "os" ) type Page struct { Title string ...

1 answers | 6 hours ago by astropanic on Stack Overflow
0 answers

go tls connection to apple push notification server is not working

My code look like below package main import ( "crypto/tls" "crypto/x509" "log" "io/ioutil" ) func main() { c := "pub.pem" p := "pri.pem" cert, err := ...

3 answers

How to check if an object has a particular method?

In Go, how do you check if an object responds to a method? For example, in Objective-C this can be achieved by doing: if ([obj respondsToSelector:@selector(methodName:)]) { // if method exists ...

3 answers | 14 hours ago by Nishanth on Stack Overflow
2 answers

In golang,How can I override the embdded struct's method

Code here package main import "fmt" func main() { t16() } type Base struct { val int } func (b *Base)Set(i int) { b.val = i } type Sub struct { Base changed bool } func (b ...

1 answer

Should all independent tasks be processed outside the http connection goroutine?

Since golang handles incoming requests in separate goroutines, it's unclear to me which types of tasks should be deferred for processing by a message queue e.g. NSQ consumers and which should be ...

1 answers | 17 hours ago by paulkon on Stack Overflow
1 answer

Wrapping a writer in a reader in Go?

I'm trying to write a function in Go which generates XML and returns a reader for it. However, the XML encoder seems to take a writer to write to and I'm not quite sure how to pipe the output of the ...

1 answers | 17 hours ago by Gabe on Stack Overflow
3 answers

how do you use golang with a private gitlab repo?

Gitlab is a free, open-source way to host private .git repositories but it does not seem to work with golang. When you create a project it generates a URL of the form: ...

3 answers | 17 hours ago by James Fremen on Stack Overflow
2 answers

Why use prepared statements instead of Query / Exec with go sql package?

In the go sql package, I understand that each statement should be closed after execution. Why would someone use prepared statements instead of just the raw Query or Exec methods?

2 answers | 18 hours ago by Robert Zaremba on Stack Overflow
3 answers

Read unicode characters with bufio scanner in Go

I'm trying to read a plain text file that contains names like this: "CASTAÑEDA" The code is basically like this: file, err := os.Open("C:/Files/file.txt") defer file.Close() if err != nil { ...

3 answers | 21 hours ago by afboteros on Stack Overflow
1 answer

Will the login functionality build into the Users API stop working on April 20th?

I am currently using the Users API (this one here) with the Go language on my Google App Engine application. My users are getting the warning message when they first grant permissions that says ...

1 answer

How to avoid Scan pair: <nil> *json.RawMessage errors on nullable JSON columns?

Several weeks ago I started to learn go and trying to build a simple blogging application while learning the basics. Currently I'm trying to fetch and persist blog posts using database/sql and ...

1 answers | 23 hours ago by foozy on Stack Overflow
0 answers

Connecting with ssh through the shell?

I am working with Go trying to automate keeping track of all of my ssh connections. I am having some issues running the command from Go. Here is my code: cmd := exec.Command("ssh", string(c.Address)) ...

1 answer

Overhead of ASM-function-call in go

I currently play around with go, it's assembly, performance of floating point operations (float32) and optimizations in the nano-seconds-scale. I was a bit confused by the overhead of a simple ...

3 answers

Avoiding Go copying interface data

This is part of real world code I'm trying to write. The problem is that Go copies the interface sibling so I can't modify the data. However, if I change to using a pointer to an interface then the ...

2 answers

Cross compile Go on OSX?

I am trying to cross-compile a go app on OSX to build binaries for windows and linux. I have read everything what I could find on the net. Closest example that I have found has been published on ...

1 answer

How to speed up Google App Engine Go unit tests?

I am currently writing a lot of unit tests for my package that runs on GAE Go. The package in question is focused on data saving and loading to and from appengine/datastore. As such, I have about 20 ...

2 answers

Is there an easier way to add a layer over a JSON object using Golang JSON Encoding?

The out of the box JSON encoding in Go is really nice, but I need to get the output to match a certain format by adding a layer. I've figured out a way, but was hoping that there would be an easier ...

2 answers | yesterday by justdewit on Stack Overflow
2 answers

How to build a release version binary in Go?

In C, we can build a debug version or a release version of the binary files (the object files and the executable). How can we do this in Go?

2 answers | yesterday by catric mia on Stack Overflow
1 answer

go test flag: flag provided but not defined

Hi I am using a flag when testing in go: file_test.go var ip = flag.String("ip", "noip", "test") I am only using this in one test file. And it works fine when only testing that one test file, but ...

1 answers | yesterday by Chris G. on Stack Overflow
2 answers

GoREST endpoint path

I'm writting a web service with Go and I'd like to have url like : I'm using GoREST and my Endpoint url is : method:"GET" ...

2 answers | yesterday by user2095568 on Stack Overflow
1 answer

Sort pair in GoLang

I know how to sort key/value with data type: map[1:a 2:c 0:b] using sort package of GoLang. How can I sort a Pair like the following: [{c 2} {a 1} {b 0}] I want the whole pair to be sorted ...

5 answers

Does any golang interactive debugger exist?

The title pretty much sums it up. I am trying out Go and I really miss being able to set breakpoints and step in/over/out as much as I want within an interactive environment. I know I can use gdb to ...

5 answers | yesterday by Daniel Williams on Stack Overflow
2 answers

Is main.go required in a Go project?

Without a background in C and only "beginner" experience in Go I'm trying to work out whether main.go is actually required or is just a convention. I'm looking to create a simple web API but could ...

2 answers | yesterday by tommyd456 on Stack Overflow
2 answers

Calling a registered RPC method on same server in Golang

I have some methods registered to a type in server program for RPC in Golang. I want to use those methods from clients as well as the server itself. e.g. I have an addition method registered as RPC ...

2 answers | yesterday by user3545351 on Stack Overflow
2 answers

convert interface{} to int in Go Lang

I am new to GO language and I am trying to get a value from a json and cast it to int but it doesn't work. Don't know how to do it properly. Here is the error message: ...cannot convert val (type ...

2 answers | yesterday by Nick on Stack Overflow
3 answers

What is the Big O performance of maps in golang?

The "Map types" section of the go language specification describes the interface and general usage of map types and the "Go maps in action" post on The Go Blog casually mentions hash tables and "fast ...

3 answers | yesterday by maerics on Stack Overflow
3 answers

Concatenate two slices in Go

I'm trying to combine the slice [1, 2] and the slice [3, 4]. How can I do this in Go? I tried: append([]int{1,2}, []int{3,4}) but got: cannot use []int literal (type []int) as type int in append ...

3 answers | yesterday by Kevin Burke on Stack Overflow
15 30 50 per page
1 2 3