1 answer

How to convert an unmarshalled Golang object to the type of a specified variable

I'd like to marshal a variety of objects to file, then unmarshal them, and convert them back to their original type by getting the type of the variables which were marshalled. The key point is that ...

2 answers

Compile App Engine application in Travis

Is there any way to run the compiler on an App Engine application written in Go without continue to serve the application with the development server and instead get an exit code? Because I want to ...

1 answer

Go to test website status (ping)

Is there any other better way to ping websites and check if the website is available or not? I just need to get the status code not get(download) all websites... func Ping(domain string) int { ...

1 answers | 7 hours ago by EPSILONsdfsdfdsf on Stack Overflow
4 answers

How to convert from []byte to int in Go Programming

I need to create a client-server example over TCP. In the client side I read 2 numbers and I send them to the server. The problem I faced is that I can't convert from []byte to int, because the ...

0 answers

datastore.Put working locally but not from the server

I'm working through this AppEngine, Go, AngularJS tutorial ( and having trouble with one handler. I made an addWordsHandler, working locally but not from ...

3 answers

Check if there is something to read on STDIN in golang

I need a command line utility to behave different if some string is piped into its STDIN. Here's some minimal example: package main // file test.go import ( "fmt" "io/ioutil" "os" ) ...

3 answers | 10 hours ago by sontags on Stack Overflow
2 answers

What happens if i modify the slice I'm range'ing over?

I recently noticed that I had done this: for t, ts := range timespans { // remove current item if t+1 < len(timespans) { timespans = append(timespans[:t], timespans[t+1:]...) } ...

2 answers | 10 hours ago by Filip Haglund on Stack Overflow
1 answer

Golang RESTful API load testing causing too many database connections

I think I am having serious issue managing database connection pool in Golang. I built an RESTful API using Gorilla web toolkit which works great when only few requests are being sent over to the ...

1 answer

Golang, variable wtih type from string

Is it possible to create variable with type from string? Example:  I have two types: type FirstType struct { ... } type SecondType struct { ... } // also I have a string variable var1 ...

1 answers | 12 hours ago by rtm7777 on Stack Overflow
1 answer

Go: Loadbalancing with the default RPC package?

Is there a way for loadbalancing RPC calls witch the default rpc package in go?

1 answers | 12 hours ago by machete on Stack Overflow
0 answers

How to visualize code coverage information on Go GAE apps?

I am developing a server with the latest Go GAE SDK. I am running tests after every change: goapp test -test.v=true I am using -cover to record coverage as described by goapp help testflag: goapp ...

2 answers

Using variable-length array as a map key in golang

I can't find a good way to do this. I want to have a map from a list of sorted key-value pairs. type Tag struct { key string value string } type SortedTag []Tag // sorted list of tags. ...

2 answers | 13 hours ago by Jeeyoung Kim on Stack Overflow
0 answers

etcd standby mode in 0.5.0

In etcd v0.4.6 standby node was able to act as peer node if one of peer nodes is dead. Standbys are not part of the Raft cluster themselves. Standby node was able to replace dead peer node ...

1 answer

Login via POST does not yield valid session

I am currently trying to convert a smallish app from nodejs to golang (hence the two tags) but I'm running into a bit of trouble in doing so. Essentially it is a very simple http POST login which I ...

1 answers | 15 hours ago by Leon on Stack Overflow
4 answers

How do you serve a static html file using a go web server?

How do you serve index.html (or some other static HTML file) using a go web server? I just want a basic, static HTML file (like an article, for example) which I can serve from a go web server. The ...

4 answers | 17 hours ago by nairware on Stack Overflow
1 answer

Golang template : Use pipe to uppercase string

I want to upper case a string in a golang template using string.ToUpper like : {{ .Name | strings.ToUpper }} But this doesn't works because strings is not a property of my data. I can't import ...

1 answer

Using the go-fuse package in Golang

Hello I'm about to port my two almost working simple fuse filesystems from bazillion fuse to go-fuse. go-fuse api seems more complex. The question is: In NewServer(), which RawFileSystem to ...

1 answers | 18 hours ago by goen on Stack Overflow
0 answers

Debugging Go via GDB with Vim (not gvim)

I am starting to get into Go, as it seems like an interesting language for web service development. I have historically created a new Ubuntu Server 14.04 instance for each of my language groups, and ...

1 answer

Go: accept different socket calls in one function

I'm trying to get my web server to accept different socket calls in one function. My code looks like this: Go: func handler(w io.Writer, r *io.ReadCloser) { //do something } func main() { ...

1 answers | yesterday by user3918985 on Stack Overflow
2 answers

Is it possible to read .mat files in Go?

I'd like to load a MATLAB file that stores a 1x1 struct with 4 fields using Go. I haven't found anything comparable to Python's SciPy which has a "loadmat" function. What is the best way to read .mat ...

2 answers | yesterday by Adam Soffer on Stack Overflow
0 answers

golang opening second terminal/console

I have been looking around and can't find another question like this for golang. Is there a way in golang to open a second console / terminal window and send output to it? I basically want to use ...

2 answers

Get entity by id

I am using gorilla mux for my routes and I pass an id. Using that Id how can I get a entity from datastore. param := mux.Vars(r) c := appengine.NewContext(r) item := []Item{} pr, err := ...

2 answers | yesterday by alex on Stack Overflow
1 answer

goapp fmt source code directory

While following the example for golang on Google App Platform website I've found that it recommends to put the source files straight into the subfolder of the application folder, e.g. app/ hello/ ...

1 answers | yesterday by AlexAtNet on Stack Overflow
2 answers

Regexp in Golang not matching

I'm currently writing tests for SQL using the package sqlmock, however, I've been unable to find a regular expression that seems to match what I would have thought was a relatively simple expression. ...

2 answers | yesterday by Jamie on Stack Overflow
2 answers

Inconsistent behavior in Go switch case

This is very unusual: given the same input, Go will behave differently at random. package main import "fmt" func main() { var i string fmt.Scanf("%s\n", &i) fmt.Println(i) ...

2 answers

How to remove fields from json in go?

I've this struct in my code. type AppVersion struct { Id int64 `json:"id"` App App `json:"app,omitempty" out:"false"` AppId int64 `sql:"not ...

2 answers | yesterday by ventayol on Stack Overflow
1 answer

beego, redefined page not found, 404 page is not show html, why?

I redefined the page_not_found on router.go, func page_not_found(rw http.ResponseWriter, r *http.Request) { t, _ := template.ParseFiles(beego.ViewsPath + "/404.html") data := ...

2 answers

Subject encoded email (RFC2047). Decodes wrong

I'm writing app in Golang. I need to decode email subject. Original subject: Raport z eksportu ogłoszeń nieruchomości Encoded subject: ...

2 answers | yesterday by JakubKubera on Stack Overflow
2 answers

Equivalence of abstract classes/methods (Java) in Google Go

I am new to Go and I'm wondering how I can implement a structure similar to abstract classes & methods in Java. In Java, I'd do the following: abstract class A{ static method1(){ ... ...

1 answer

Golang - Pipe to external exec

I'm trying to use Go to pipe an email message to the sendmail binary. The following code works providing I don't uncomment the call to Wait(). If it's uncommented, the program hangs. Reading the ...

1 answers | yesterday by Steve Crook on Stack Overflow
15 30 50 per page
1 2 3