[go-nuts] External/internal linker and cgo packages

2020-04-28 Thread Vincent Blanchon
Hello, I'm building a simple program that has a dependency to github.com/DataDog/zstd, a wrapper of a C code. So by default, Go will use the external linker. When debugging with, I can see host link: "clang" "-m64" "-Wl,-headerpad,1144" "-Wl,-no_pie" "-Wl,-pagezero_size,400" "-o"

Re: [go-nuts] Why do we use xchg rather than lock mov to inplement atomic.StoreX?

2020-04-28 Thread Cholerae Hu
On x86-TSO model, it seems that we don't need any mfence to archive acquire-release semantics. Acquire-release semantics only need compiler barrier to prevent compiler reordering, see https://godbolt.org/z/7JcX-d . 在 2020年4月29日星期三 UTC+8上午7:42:26,keith@gmail.com写道: > > It looks like the

[go-nuts] http middleware and request context

2020-04-28 Thread Anuj Agrawal
Hi, I have a situation where I have a chain of middlewares with a logger middleware that comes before an authentication middleware. Logger middleware logs about the incoming request, calls the next middleware in the chain and then logs about the response. Authentication middleware authenticates

Re: [go-nuts] Is this AMQP 0.9.1 library updated?

2020-04-28 Thread Kurtis Rader
On Tue, Apr 28, 2020 at 7:23 PM 'Wesley Peng' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I tried to access RabbitMQ using this AMQP library: > https://github.com/streadway/amqp > > I am not sure if this library get updated following the recent RMQ version. > Please suggest, thanks.

[go-nuts] Is this AMQP 0.9.1 library updated?

2020-04-28 Thread 'Wesley Peng' via golang-nuts
Hello, I tried to access RabbitMQ using this AMQP library:https://github.com/streadway/amqp I am not sure if this library get updated following the recent RMQ version.Please suggest, thanks. Wesley Peng wesleyp...@aol.com -- You received this message because you are subscribed to the Google

Re: [go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2020-04-28 Thread Fino
OK, more complex than I thought. need more learning ~ BR fino -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To

Re: [go-nuts] Need a way to check only key exist or not? without value?

2020-04-28 Thread Shishir Verma
I think it is kind of intuitive that empty struct takes 0 bytes whereas a bool variable takes 1 byte in memory and hence a map with struct{} values would consume lesser memory than the other. I tried checking this using code and Randall's point proves: mapmem.go: package main import (

Re: [go-nuts] Why do we use xchg rather than lock mov to inplement atomic.StoreX?

2020-04-28 Thread keith . randall
It looks like the mechanism used by C's std::atomic would not be useful for us. We require release semantics on atomic stores. That is, if one thread does: .. some other writes ... atomic.StoreInt32(p, 1) and another thread does if atomic.LoadInt32(p) == 1 { .. some other reads ... } If

Re: [go-nuts] Deleting map entry from the top level of a nested map doesn't clean the underlying memory

2020-04-28 Thread Ian Lance Taylor
On Tue, Apr 28, 2020 at 1:00 PM Naveen Kak wrote: > Basically using the Top command at end of test. > The top command will show you the memory that the program has requested from the operating system and has not returned to the operating system. The Go memory allocator works by requesting

Re: [go-nuts] Deleting map entry from the top level of a nested map doesn't clean the underlying memory

2020-04-28 Thread Robert Engels
Also, it may just be that the runtime is better off allocating more and not doing a GC based on available memory and CPU usage. The “max heap” feature in development may help here. > On Apr 28, 2020, at 3:18 PM, 'Kevin Chowski' via golang-nuts > wrote: > >  > Guessing based on your latest

Re: [go-nuts] Deleting map entry from the top level of a nested map doesn't clean the underlying memory

2020-04-28 Thread 'Kevin Chowski' via golang-nuts
Guessing based on your latest description: are you aware that there is no partial slice collection in GC? That is: > bigSlice := make([]int, 1000*1000) subSlice := bigSlice[0:1:1] bigSlice = nil runtime.GC() // At this point, bigSlice is still allocated! It cannot be freed by the GC >

Re: [go-nuts] Concurrent io.Copy(tcpConn, file) and tcpConn.Write(...)

2020-04-28 Thread Brian Candler
On Tuesday, 28 April 2020 21:09:38 UTC+1, Liam wrote: > > The Linux kernel has TLS; one reason is to allow sendfile(2) with TLS. But > I guess Go doesn't enable that yet? > > https://www.kernel.org/doc/html/latest/networking/tls.html > >

Re: [go-nuts] Concurrent io.Copy(tcpConn, file) and tcpConn.Write(...)

2020-04-28 Thread Liam
The Linux kernel has TLS; one reason is to allow sendfile(2) with TLS. But I guess Go doesn't enable that yet? https://www.kernel.org/doc/html/latest/networking/tls.html On Tuesday, April 28, 2020 at 12:39:04 PM UTC-7, Robert Engels wrote: > > Depends on how the file descriptor is implemented.

Re: [go-nuts] Deleting map entry from the top level of a nested map doesn't clean the underlying memory

2020-04-28 Thread Naveen Kak
Basically using the Top command at end of test. Let me give a quick summary of the scenario. Basically we have an application which keeps getting data on a TCP connection, we allocate a global slice to temporarily hold the data and then store in nested maps. For every TCP data transaction, we

Re: [go-nuts] Concurrent io.Copy(tcpConn, file) and tcpConn.Write(...)

2020-04-28 Thread Robert Engels
Depends on how the file descriptor is implemented. But the end result probably has the same performance unless the network card is doing the TLS - which is possible. > On Apr 28, 2020, at 2:21 PM, Tamás Gulácsi wrote: > >  > TLS needs encyption, not jost "shoveling the bytes" to the

Re: [go-nuts] Concurrent io.Copy(tcpConn, file) and tcpConn.Write(...)

2020-04-28 Thread Tamás Gulácsi
TLS needs encyption, not jost "shoveling the bytes" to the underlying connection. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] Concurrent io.Copy(tcpConn, file) and tcpConn.Write(...)

2020-04-28 Thread Liam
On Tuesday, April 28, 2020 at 1:42:15 AM UTC-7, Liam wrote: > > > > On Tuesday, April 28, 2020 at 12:05:00 AM UTC-7, Liam wrote: >> >> >> >> On Monday, April 27, 2020 at 10:00:52 PM UTC-7, Ian Lance Taylor wrote: >>> >>> On Mon, Apr 27, 2020 at 6:59 PM Liam wrote: >>> > >>> > On Monday, April

Re: [go-nuts] Json Parse Data [unexecpted non whitespace 1 to 28]

2020-04-28 Thread Marcin Romaszewicz
Ali, your example has several problems. First, you do this: var p Person data, err := json.Marshal(p); if err != nil{ fmt.Println("Error", err) } What this does is encode an empty object, that's fine. Next, you read the HTTP body from the request, and try to unmarshal that.

Re: [go-nuts] Need a way to check only key exist or not? without value?

2020-04-28 Thread adithyasashasai
is it mentioned anywhere such that "map[string]struct{}" is efficeient? On Tuesday, April 28, 2020 at 10:23:08 AM UTC+5:30, Randall O'Reilly wrote: > > I think map[string]struct{} takes no storage for the value and is the most > efficient way to do this. > > - Randy > > > On Apr 27, 2020, at

[go-nuts] json decode is very slow

2020-04-28 Thread Sarath Prabath Redlapalli Jaya
req := {} json.NewDecoder(r.Body).Decode(req) We've instrument the above code block and reading request body bytes is taking very long i.e., upto 5 secs sometimes reaching upto 20 seconds at the throughput of ~4-5K RPM The Request Body Size Metrics are as follows Average: 73190 Bytes 90th

[go-nuts] Re: Json Parse Data [unexecpted non whitespace 1 to 28]

2020-04-28 Thread Ali Hassan
https://play.golang.org/p/cRBdSyGcGfp Demo Version On Tuesday, April 28, 2020 at 1:53:38 PM UTC+5, Ali Hassan wrote: > > [image: Capture.JPG] > > Data : TYPE OF Json > > > > var member Member // struct where json > data, err :=json.Marshall(member); if err != nil{ fmt.Printf("Error %s", > err)}

[go-nuts] Re: Json Parse Data [unexecpted non whitespace 1 to 28]

2020-04-28 Thread Ali Hassan
I try On Tuesday, April 28, 2020 at 1:53:38 PM UTC+5, Ali Hassan wrote: > > [image: Capture.JPG] > > Data : TYPE OF Json > > > > var member Member // struct where json > data, err :=json.Marshall(member); if err != nil{ fmt.Printf("Error %s", > err)} > fmt.Printf("Data", data) > > err =

Re: [go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2020-04-28 Thread Elias Naur
On Tue, Apr 28, 2020 at 3:23 PM Fino wrote: > > hello Elias, > > as far as I understand, GIO is a 2D GUI lib, maybe similar with Flutter, > > is it possible to embed one/multi 3D widget inside a view/window? > > any architecture thinking on such requirement? > The other way around is possible:

[go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2020-04-28 Thread Fino
hello Elias, as far as I understand, GIO is a 2D GUI lib, maybe similar with Flutter, is it possible to embed one/multi 3D widget inside a view/window? any architecture thinking on such requirement? BR fino -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: marshal multiple json documents which may have different format versions into the latest struct version

2020-04-28 Thread Manlio Perillo
On Tuesday, April 28, 2020 at 10:52:56 AM UTC+2, Chris Burkert wrote: > > Dear all, > > my application users shall be able to provide multiple json documents > (files and urls) which I'd like to marshall into one structure. > Additionally these json documents may have different versions. I know

Re: [go-nuts] Why do we use xchg rather than lock mov to inplement atomic.StoreX?

2020-04-28 Thread Cholerae Hu
But on gcc 9.3, atomic store with seq_cst order, will be compiled to mov+fence rather than xchg, see https://gcc.godbolt.org/z/ucbQt6 . Why do we use xchg rather than mov+fence in Go? 在 2020年4月28日星期二 UTC+8上午7:26:15,Ian Lance Taylor写道: > > On Sun, Apr 26, 2020 at 1:31 AM Cholerae Hu > wrote: >

[go-nuts] Re: Json Parse Data [unexecpted non whitespace 1 to 28]

2020-04-28 Thread Brian Candler
Can you make this into a standalone reproducing test case on play.golang.org, then share the URL with us? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] Re: func before function

2020-04-28 Thread Ali Hassan
may be that's the way compiler understand where new function start On Monday, April 27, 2020 at 9:46:20 PM UTC+5, valen...@gmail.com wrote: > > Why is it necessary to write func in go before declaring a function; if in > C, when parsing a function, there is no such need? > Why "func sum(a, b

[go-nuts] Re: func before function

2020-04-28 Thread Volker Dobler
On Monday, 27 April 2020 18:46:20 UTC+2, valen...@gmail.com wrote: > > Why is it necessary to write func in go before declaring a function; if in > C, when parsing a function, there is no such need? > Why "func sum(a, b int) int {...}" can't be "sum(a, b int) int {...}" > Of course it could be

[go-nuts] Json Parse Data [unexecpted non whitespace 1 to 28]

2020-04-28 Thread Ali Hassan
[image: Capture.JPG] Data : TYPE OF Json var member Member // struct where json data, err :=json.Marshall(member); if err != nil{ fmt.Printf("Error %s",err )} fmt.Printf("Data", data) err = json.NewDecoder(request.Body).Decode(); if err != nil {fmt. Printf("Error %s",err) // this is print

[go-nuts] marshal multiple json documents which may have different format versions into the latest struct version

2020-04-28 Thread Chris Burkert
Dear all, my application users shall be able to provide multiple json documents (files and urls) which I'd like to marshall into one structure. Additionally these json documents may have different versions. I know how to marshal a document into a version specific struct if I know the format

Re: [go-nuts] Concurrent io.Copy(tcpConn, file) and tcpConn.Write(...)

2020-04-28 Thread Liam
On Tuesday, April 28, 2020 at 12:05:00 AM UTC-7, Liam wrote: > > > > On Monday, April 27, 2020 at 10:00:52 PM UTC-7, Ian Lance Taylor wrote: >> >> On Mon, Apr 27, 2020 at 6:59 PM Liam wrote: >> > >> > On Monday, April 27, 2020 at 5:56:52 PM UTC-7, Ian Lance Taylor wrote: >> >> >> >> On Mon,

Re: [go-nuts] Concurrent io.Copy(tcpConn, file) and tcpConn.Write(...)

2020-04-28 Thread Liam
On Monday, April 27, 2020 at 10:00:52 PM UTC-7, Ian Lance Taylor wrote: > > On Mon, Apr 27, 2020 at 6:59 PM Liam > > wrote: > > > > On Monday, April 27, 2020 at 5:56:52 PM UTC-7, Ian Lance Taylor wrote: > >> > >> On Mon, Apr 27, 2020 at 5:10 PM Liam wrote: > >> > > >> > On Monday, April