Questions tagged [go]

Go is an open source programming language initially developed at Google. It is statically-typed, with a syntax loosely derived from C, adding automatic memory management, type safety, some dynamic typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a ...

0
votes
0answers
5 views

golang combining multiple url queries in html

everybody! I need your help. I have added filter queries var ( cDate = "" cStatus = "" cLimit = "20" cOffset = "0" *default values if no one of the queries* )...
0
votes
1answer
12 views

Ship Golang binary with dynamic(config.toml) configuration file

I have a simple go server that works, and gets most of its configuration settings from a toml file. The current process involves restarting the go build source every time the settings are changed. ...
0
votes
0answers
14 views

Persisting State Across tests in GoLang

I am looking to instantiate an object and update the state of this object across multiple function calls in a Go Test. My main logic looks like this: type User struct { Username string ...
0
votes
2answers
33 views

Why is value changing after function execution?

I'm currently teaching myself Go, and I'm having trouble understanding a certain behavior: package main import ( "fmt" ) type List struct { n int } func (l List) Increment() { l.n += 1 ...
0
votes
0answers
8 views

gob.Register name not registered for interface in another package

I have recently restructured my code so that now under the main package there are two packages: chain and api. In chain I defined a few structs someStruct1, someStruct2 and an interface someInterface ...
0
votes
0answers
24 views

Golang complex formal argument for hex.EncodeToString [duplicate]

I have two pieces of code, one works while the other doesn't. Can you please tell me the difference between these two: This code works: targetHash := md5.Sum([]byte(fmt.Sprintf("%s:%s:%s", ra.User, ...
0
votes
2answers
23 views

Golang context confusion regarding cancellation

package main import ( "context" "fmt" "sync" "time" ) func myfunc(ctx context.Context) { for { select { case <-ctx.Done(): fmt.Printf("Ctx is ...
-1
votes
1answer
27 views

Why GO panics with 'concurrent map writes' here?

When trying to use this struct with multiple goroutines sometimes I get one of these errors: fatal error: concurrent map read and map write or concurrent map writes After reading the this thread ...
1
vote
1answer
31 views

How to generate entropy by myself? - RSA Golang

I'm working with Golang's RSA encryption library. The following is the function to encrypt a message: func EncryptOAEP(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte) ([]...
0
votes
0answers
29 views

Golang remove dup ints from slice append function “evaluated but not used”

I can't get this Go lang test program to run. The compiler keeps giving an error on the append() function call below with an "evaluated but not used" error. I can't figure out why. package main ...
0
votes
1answer
20 views

Goroutine Termination on Calling Function Return

If I spawn a goroutine in a function and that function returns, will the goroutine terminate, or will it continue to execute?
2
votes
1answer
14 views

Import full contents of package in Golang

I'm wondering if there is any way to import the full contents of a package so that I don't have to prefix calls to things in the package with a package name? For example, is there a way to replace ...
-3
votes
0answers
16 views

Example of web form using paiza and golang? [on hold]

I'm trying to get started using paiza for golang. It took only a minute or so on the paiza website to get a working web page, which was impressive. I'm trying to find an example to follow to be able ...
0
votes
0answers
18 views

How to check value of interface to nil? [duplicate]

I created a variable b var b *B Then I pass it to function like this: func f(a interface{}) { if a == nil{ fmt.Println("argument is nil") } } The a==nil comprasion will give me ...
-1
votes
0answers
23 views

How to determine interface's value equals to nil? [duplicate]

I created b variable: func main() { var b *B if b == nil { fmt.Println("b is nil") } } Everything works as expected and I see: b is nill But when I pass b to function like this:...

15 30 50 per page