[go-nuts] Re: unpacking map[string]interface{} answer

2021-05-30 Thread natxo....@gmail.com
hi, I got privately an answer to get the type of variable, so I tried this: client := foreman.Client("foreman.l.example.org", "admin", "whatever", false, "") resp, err := client.Get("hosts") if err != nil { fmt.Println(err) } fmt.Printf("%T\n", resp) and the

[go-nuts] unpacking map[string]interface{} answer

2021-05-30 Thread natxo....@gmail.com
hi, I am struggling to understand how to use this map[string]interface{}. snippet: package main import "fmt" import "github.com/mattwilmott/go-foreman" func main() { client := foreman.Client("foreman.l.example.org", "admin", "whatever", false, "") fmt.Println(client) resp, err :=

Re: [go-nuts] Value copy costs are not very predictable.

2021-05-30 Thread Ian Lance Taylor
On Sun, May 30, 2021 at 4:04 AM Jan Mercl <0xj...@gmail.com> wrote: > > Within the benchmark loops of the linked code a sufficiently smart compiler > can optimize the source values away completely and/or collapse all writes to > the destination values to a single write. For example, here are the

Re: [go-nuts] Re: Value copy costs are not very predictable.

2021-05-30 Thread 'Axel Wagner' via golang-nuts
That is very normal for micro-benchmarks on a ns scale. On Sun, May 30, 2021 at 6:07 PM tapi...@gmail.com wrote: > It is some strange that if any of the bool/byte/int16/int64 benchmarks is > removed in this test file https://play.golang.org/p/w29J9VhtzYH, > then the benchmark result is like: > >

[go-nuts] Re: Value copy costs are not very predictable.

2021-05-30 Thread tapi...@gmail.com
It is some strange that if any of the bool/byte/int16/int64 benchmarks is removed in this test file https://play.golang.org/p/w29J9VhtzYH, then the benchmark result is like: Benchmark_CopyStruct_3_fields-4 10 0.7780 ns/op Benchmark_CopyStruct_4_fields-4 10

Re: [go-nuts] Value copy costs are not very predictable.

2021-05-30 Thread tapi...@gmail.com
gcflags=-S shows the code of copy 3-field and 4-field structs: // struct{a, b, c int} 0x0034 00052 (valuecopy.go:223)MOVQ$0, "".struct3_0(SB) 0x003f 00063 (valuecopy.go:223)XORPSX0, X0 0x0042 00066 (valuecopy.go:223)MOVUPSX0, "".struct3_0+8(SB) // struc

Re: [go-nuts] extract Last 2 characters in go template

2021-05-30 Thread Marvin Renich
* Pawan Kumar [210530 08:03]: > Many thanks Marvin , really appreciate it. I intended, but forgot, to hint that your FuncMap could include a function that was more specific to your problem than the sub function. ...Marvin -- You received this message because you are subscribed to the Google Gr

Re: [go-nuts] extract Last 2 characters in go template

2021-05-30 Thread Pawan Kumar
Many thanks Marvin , really appreciate it. Regards On Sat, 29 May 2021, 00:21 Marvin Renich, wrote: > * Pawan Kumar [210528 12:43]: > > Hi Team, > > > > I was using slice function to extract last 2 characters in go template > but > > not able to do ,as -ve range is not supported by slice funct

Re: [go-nuts] Value copy costs are not very predictable.

2021-05-30 Thread Jan Mercl
Within the benchmark loops of the linked code a sufficiently smart compiler can optimize the source values away completely and/or collapse all writes to the destination values to a single write. Have you looked at the actual code the CPU executes? > > -- You received this message because you ar