2 answers

Can vim-go completion third party framework

I use vim-go plugin and it can autocompletion the build in framework such as "fmt", "os" etc. But cannot completion third party framework.

2 answers | 3 mins ago by heramerom on Stack Overflow
1 answer

Go change struct property values Trying to get my head around Go, still pretty new. I know refs and pointers in C and I can't seem to get it working in Go. I've read ...

1 answers | 4 mins ago by nathan rogers on Stack Overflow
0 answers

How is testify/assert.Contains used with a map?

the docs show this as an example: assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") But running this fails mymap := map[string]string{} mymap["Hello"] = ...

0 answers

golang json decoder websocket stream

Hey guys I am getting websocket information from external Api and it's give me json response in this way: ...

3 answers

Go session variables?

I'm new to the Go language (Golang) and I'm writing a web-based application. I'd like to use session variables, like the kind in PHP (variables that are available from one page to the next and unique ...

2 answers

How to write a text mode gui in Linux?

When I write scripts/programs, often I would like to pop up a simple text 'gui' to prompt for input: How would I do this? For example from Shell, Ruby, Golang or C. I don't even know what this is ...

2 answers | 2 hours ago by Sonia Hamilton on Stack Overflow
1 answer

In golang my go routines are using all cores, but only between 50 and 75% of each core

I am using version go1.5.3 linux/amd64 of the go language. I have a go routine that performs a mathematical operation that takes some time. Each go routine acts independently and does not have to ...

2 answers

Go- Why Does My For Loop Throw “Unexpected Semi-colon or New-line”?

I'm writing a dice rolling function. In order to add the result of each die, I added to an output variable using a for loop. However, I'm getting an error thrown when I attempt to build; syntax ...

2 answers | 3 hours ago by toastergod on Stack Overflow
1 answer

Golang : gorm ORM has many relation giving empty result

I am trying to define one to many relation with gorm ORM . I have read all the docs over and over again . Could not find a way to do it. func GetUser1(c *gin.Context) { var user models.User ...

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

How do I import rows to Postgresql from STDIN?

In Python I have the following that will bulk-load rows to Postgresql without using a file: import csv import subprocess mylist, keys = [{'name': 'fred'}, {'name': 'mary'}], ['name'] p = ...

2 answers

Is it possible to use “freopen”-like construction in Go?

In C++ there's a freopen func, which is very useful to r/w files with just stdin/out(cin/cout). So I decided to find similar solution in Go, but found only import "os" os.Stdin, err = ...

2 answers | 7 hours ago by LavX64 on Stack Overflow
2 answers

Jump to specific line in file in Go

In Go is it possible to jump to particular line number in a file and delete it? Something like linecache in python. I'm trying to match some substrings in a file and remove the corresponding lines. ...

2 answers | 8 hours ago by user3502035 on Stack Overflow
1 answer

Golang testing using local files

I'm looking for what best practice I should use when it comes to testing with Golang using local files. By using local files, I mean that in order to test functionality, the application needs some ...

1 answers | 8 hours ago by Miller on Stack Overflow
4 answers

Why does golang RGBA.RGBA() method use | and <<?

In the golang color package, there is a method to get r,g,b,a values from an RGBA object: func (c RGBA) RGBA() (r, g, b, a uint32) { r = uint32(c.R) r |= r << 8 g = uint32(c.G) ...

4 answers | 8 hours ago by Wang Ke on Stack Overflow
2 answers

Marshaling a nested map into JSON

I'm trying to marshal this nested map into a JSON string. map[ description:Foo Bar url: theme_color:#1b1b1b markdown:kramdown sass:map[ style:compressed ] ...

2 answers | 9 hours ago by Dan Prince on Stack Overflow
1 answer

How go install finds out when to rebuild?

I'm trying to use go install inside a drone build with caching(whole $GOPATH, see and it works but go install rebuilds all packages doesn't matter what I do with ...

1 answers | 10 hours ago by let4be on Stack Overflow
1 answer

How to iterate over a list and draw a table with the goterm package?

I am trying to rapidly prototype something with goterm. I have a list of user objects in a struct. I want to output a header row (works) then iterate over the list (works) and add a row for each user. ...

1 answers | 11 hours ago by n8gard on Stack Overflow
1 answer

How to unpack a git pack file with Go?

I'm trying to unpack a git pack file using pure go. The only lib I could find is -> parse but I have a hard me to figure out how it is supposed to work. Basically all I ...

1 answers | 12 hours ago by The user with no hat on Stack Overflow
1 answer

Go : assignment to entry in nil map

I'm rather new in go, and I searched for this trouble on this site, and founed answered questions, but cannot implement those answers to my case. I have a code : func receiveWork(out <-chan Work) ...

1 answers | 13 hours ago by Altenrion on Stack Overflow
6 answers

How to assign string to bytes array

I want to assign string to bytes array: var arr [20]byte str := "abc" for k, v := range []byte(str) { arr[k] = byte(v) } Have another method?

6 answers | 18 hours ago by sofire on Stack Overflow
1 answer

How to initialize Go struct with anonymous member of pointer type?

the normal way to initial a struct with anonymous member is like this: package main import "fmt" type AA struct { int xx string } func main() { a := &AA{ ...

1 answers | 21 hours ago by HardySimpson on Stack Overflow
0 answers

How do I return an empty string from an RPC call?

I have an RPC system, where the interface used for the result is as follows: type ValReply struct { Val string } Sometimes, my RPC will set reply.Val to ""(the empty string). In these cases, ...

1 answer

Golang create a slice of maps

I was trying to create a slice of maps the following way. keyvalue := make(map[string]interface{}) keyvalueslice := make([]keyvalue, 1, 1) I was trying to create it just like the way string slice ...

1 answer

Array Varchar (psql) to array string (golang)

I would like to know how i can get my array varchar in my psql database in array string in go for render it in json. I actually do that In creation of my table i create my column like that : tags ...

1 answers | yesterday by Fantasim on Stack Overflow
2 answers

GOlang + Angular2

i started trying to work with Go and Angular2, but i have a weird issue.. i guess i'm just missing a tiny detail, but i can't figure it out. I'm using as a ...

1 answer

How can pass value from MySQL to go template

This struct to pass value to template type Entry struct { Name, Mes string } This function to handle with HandleFunc("/", mysqlWithTempl) func mysqlWithTempl(w http.ResponseWriter, r ...

1 answers | yesterday by Codie on Stack Overflow
1 answer

How can I convert an int64 into a byte array in go?

I have an id that is represented at an int64. How can I convert this to a []byte? I see that the binary package does this for uints, but I want to make sure I don't break negative numbers.

1 answers | yesterday by Charles L. on Stack Overflow
2 answers

How to get sorted list of map keys in Go?

Let's imagine I have a map: map[string]string. I would like to get the list of sorted keys for this map. So I could do something like this: func SortedMapKeys(m map[string]string) (keyList []string) ...

0 answers

EnumChildWindows callback function in golang

Using package lxn/win in main: win.EnumChildWindows(hw, printme, 0) Then after main: func printme(HWND win.HANDLE, LPARAM uintptr) { //HWND hwnd, LPARAM lParam spew.Dump(HWND) } I get: ...

1 answer

In Golang, how to receive multicast packets with socket bound to specific address/port?

Task at hand is to bind a socket specifically to address (assigned to eth2), then read multicast UDP packets addressed to I am trying the code below, based on ...

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