Questions tagged as 'golang'

1
answer

Referencing Variables in HTML

I'm a beginner in web programming and I have a simple (I think) doubt: I was wondering if there is any way to reference variables from a backend language (in my case I'm using Go-lang) in HTML? I'm using the Bootstrap framework to build the fron...
asked by 30.09.2016 / 13:26
1
answer

Integrate nodejs (frontend) and C, Erlang, Go ... (backend) [closed]

I have a system to be developed that will need to handle a large number of simultaneous requests, where each of these requests will probably involve some task that requires a lot of processing. By researching how to deal with this situation I ca...
asked by 09.03.2016 / 21:37
1
answer

Why does Illegal invocation occur in JS?

I'm using GopherJS, and there are two ways to execute a function, via Call() or via Invoke() . Initially I was using code similar to this: js.Global.Get("navigator").Get("credentials").Get("store").Invoke( password.New(js.M{"i...
asked by 19.11.2018 / 19:18
1
answer

float64 precision

Why Go when performing the calculation: (1 * 0.09) + 0.36 returns a float64 in the following format 0.44999999999999996 ? I'm trying to make comparisons with tests and the calculation should be 0.45 because this behavior and...
asked by 03.10.2018 / 02:40
1
answer

How to pass parameters to a function all rows in an array

I need to pass all the rows of an array as parameters of a function, but I can not make it dynamic ... What I want to make dynamic args = append(args, u.yy) args = append(args, u.xx) args = append(args, u.dd) args = append(args, u.kk) smt....
asked by 23.08.2018 / 14:23
0
answers

Determine memory consumption

Hello, I'm a beginner in Go and I'm having trouble figuring out how much memory the code in Go needed to execute some code. I did the memory () function that even returns something, but I do not know what it would be like to bring the return I w...
asked by 14.10.2018 / 02:00
1
answer

Check Unix user

To verify the user name I can easily use: import ( "fmt" "os" ) fmt.Println(os.Getenv("USER")) But to make things a bit easier I would like to add a new function to struct os , so I did it as follows: func (system os) Sudo(...
asked by 19.09.2017 / 15:41
1
answer

Go function with parameters

I came across the following function in a framework of Map Reduce, but I did not understand the syntax of it. func (fc *FlowContext) newNextDataset(shardSize int, dType reflect.Type) (ret *Dataset) {     ret = NewDataset(fc, dType)     if dT...
asked by 14.11.2018 / 13:56
2
answers

How is it still possible to calculate 164-1, without issuing an overflow?

The limit of uint64 is (2 ^ 64) -1, or simply 1
asked by 04.04.2018 / 00:15
1
answer

Why does JSON or XML not work?

I have this type: type S struct { a string 'json:"a" xml:"a"' b int 'json:"b" xml:"b"' c time.Time 'json:"c" xml:"c"' } But neither JSON nor XML works: s := S{a: "Olá", b: 42, c: time.Now()} jsonTexto, err := json.Mar...
asked by 27.10.2018 / 11:32