0 answers

“missing word in phrase: charset not supported”, when using the mail package

I'm trying to parse emails and I get this kind of errors using the mail package. Is it a bug on the mail package or something I should handle myself ? missing word in phrase: charset not supported: …

0 answers

Structuring Go subpackages for teams

We are currently moving some of our codebase to Go and are struggling a bit with a flexible directory structure for multiple devs within a team. Apologies if this is a noob question but I've searched …

2 answers

Go: Why is my hashtable implementation so slow?

So I'm trying to make a super light, deliberately memory heavy, yet very fast hashtable for very fast lookups where I don't care about memory usage and I don't care if it makes a rare mistake. ...

2 answers | 4 hours ago by Alasdair on Stack Overflow
0 answers

Trying to get my sockets to read messages every 5 seconds

I am trying to get my web server to check my sockets every 5 seconds for messages. I have found a solution where I use javascript on the client side to send it but that is not a good idea for many …

1 answer

GoLang: Reading and casting bytes into struct fields

I am reading from an io.Reader into a Struct, field by field. // structFields returns a sequence of reflect.Value for field := range structFields { switch field.Kind() { case reflect.String: …

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

What does “autocmd FileType go compiler go” suppose to do?

I was trying to add the functionality that a plugin in vim statically analyses my current go (golang) file and catches errors. What I tried was doing the instructions in the readme.txt file in ...

0 answers

Cannot auto format go (golang) code in vim

I was having a problem with the following command: autocmd FileType go autocmd BufWritePre <buffer> Fmt its suppose to format my code code automatically by putting it at the end of my .vimrc …

3 answers

golang string 'replaceAtIndex' function

Say I want to replace a letter at a specific index in a string: input = aaaaaaa, output = aaabaaa. Is there a built in way to do this? I wrote the following helper function to use in the mean time: …

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

Simplest pub-sub for golang <--> python communication, possibly across machines?

I'm working on a web application written in Golang that needs to call a Python program/module to do some heavy work. Since that is very memory/CPU intensive, it may be on a separate machine. Since ...

1 answer

[Golang]Different about call a method with pointer type, using point type or struct type?

Like the title said, I don't know the different when I use the struct type or pointer type when call the method Greeting() in my case, does the call p.Greeting() and u.Greeting() just same? Seems no …

1 answers | 12 hours ago by Gohan on Stack Overflow
2 answers

Golang Parametric polymorphism?

I wrote a function in order to get the standard deviation from a array of floats, but I'm have a problem, how can I use it if I have a array of ints? I dont want to have a function for every data …

2 answers | 12 hours ago by user3613179 on Stack Overflow
3 answers

How to use custom packages in golang?

I'm trying to create and use a custom package in Go. It's probably something very obvious but I cannot find much information about this. Basically, I have these two files in the same folder: mylib.go …

3 answers | 14 hours ago by this.lau_ on Stack Overflow
1 answer

How do I call TCPConn.SetLinger()?

I'm using Go 1.2 and trying to call TCPConn.SetLinger(0) on a socket that my server is closing due to fatal errors in the input. However, I can't figure out how I would do this. Both ...

1 answers | 14 hours ago by prewett on Stack Overflow
1 answer

Go: How does this hash function range from 0-32 bits?

I'm trying to write my own hash function that uses a 30-bit hash. Here is some code for a FNVa 32-bit hash. func fnva32(data string) uint32 { var hash uint32 = 2166136261 for _, c := range …

1 answers | 14 hours ago by Alasdair on Stack Overflow
1 answer

Go: What does ^ do?

I hope this question is not too stupid... I have no idea what the ^ operator does in Go, e.g. a := 3^500 At first I thought it must be pow but it most certainly is not. It's not mod (%) either. ...

1 answers | 15 hours ago by Alasdair on Stack Overflow
1 answer

Set a pointer to a field using reflection

i have the following struct, and need some of the fields to be nulluble so i use pointers, mainly to handle sql nulls type Chicken struct{ Id int //Not nullable Name …

1 answers | 15 hours ago by FPGA on Stack Overflow
0 answers

How to create a leveldb comparator for a key = “string” nnn.nn

I having a lot a trouble with how to insert a custom comparator into go-leveldb. I just want to compare a two part key: string and float64 i.e. ("depth" 2345.6) values... The string needs on ...

1 answer

why does it seem that sleep doesn't work in goroutine

package main import ( "fmt" "time" ) func main() { c := make(chan struct{}) count := 1 go func() { for { fmt.Println("foo", count) count++ …

1 answers | 16 hours ago by ggaaooppeenngg on Stack Overflow
2 answers

How to decode mail body in Go

I'm working on an email client and part of this I need to decode the email body. I'm using the IMAP package to fetch the messages but there is no "decode" method. I also checked the enter link ...

2 answers | 16 hours ago by hey on Stack Overflow
2 answers

How to convert uint32 to string?

I need to convert an uint32 to string. How can I do that . strconv.Itoa doesn't seem to work. Long store: I need to convert an UID received through the imap package to string so that I can set it ...

2 answers | 18 hours ago by hey on Stack Overflow
1 answer

How do I check a specific network error in Go?

I have a server that I am writing, and I want to handle errors from conn.Read(). Specifically, I want to do nothing in the case that the client has closed the connection, but log the error if it is …

1 answers | 19 hours ago by prewett on Stack Overflow
2 answers

go imap: bad sequence set value “”

I'm trying to follow the IMAP example but I get this error imap: bad sequence set value "" which corresponds with the line set, _ := imap.NewSeqSet("") from the example. Is it a bug in the lib or a …

2 answers | 20 hours ago by hey on Stack Overflow
2 answers

how to analyse golang memory

I wrote a golang program, It cost 1.2GB at the runtime. when I use go tool pprof to got a dump。 It show only 323.4MB in the heap. what is other memory …

2 answers | 21 hours ago by sharewind on Stack Overflow
1 answer

How do I import a specific version of a package?

coming from a Node environment I used to install a specific version of a vendor lib into the project folder (node_modules) by telling npm to install that version of that lib from the package.json or …

1 answers | 22 hours ago by Wilk on Stack Overflow
1 answer

xml.NewDecoder(resp.Body).Decode Giving EOF Error _GOLang

I'm trying to Decode XML from body a html response. =>I saved this response body as string to a Variable and successfully decoded Using xml.Unmarshal Function .Code for that : err = ...

1 answers | yesterday by faisal k k on Stack Overflow
1 answer

How can I build varidics of type interface in Go?

I'm building mysql query dynamically ( due the mysql IN clause) so I need to pass a list of arguments as the sql.Query function requires. Any idea how can do that ? I don't really understand how the …

1 answers | yesterday by hey on Stack Overflow
2 answers

Go: Reusable barrier like Java's CyclicBarrier?

Using Google Go, I'm trying to sync multiple threads performing an iterative filter on an image. My code basically works like outlined here: func filter(src *image.Image, dest *image.Image, start, …

2 answers | yesterday by localhorst on Stack Overflow
2 answers

What is the difference between go get and go install?

After searching and playing with the go tool for a while, it looks like go get: (optionally) download, compile, and install a piece of software, while go install simply compile and install it. …

2 answers | yesterday by thiagowfx on Stack Overflow
1 answer

cannot load

I'm trying to debug a program written using Go inside eclipse. I can set and hit breakpoints pretty consistently, but I cannot view the contents of my variables. When I start debugging the program, I …

1 answers | yesterday by Dalanchoo on Stack Overflow
0 answers

Testing with the development SDK

I am developing my app using SDK v 1.9.7 in Go. Unfortunately, every test which is run adds around 2.5 - 3 seconds to the run time simply because it spends a bunch of time creating the test context. …

15 30 50 per page
1 2 3