Re: [External] Re: [go-nuts] build debug golang

2021-07-08 Thread 董⼀峰
thanks On Fri, Jul 9, 2021, 11:44 wrote: On Thu, Jul 8, 2021 at 8:41 PM 董⼀峰 wrote: > > Thanks for replying. > So golang only supports debugging optimized golang runtime? Well, Go requires that the runtime package be built with optimization (when using the gc compiler, which is the default). So, y

Re: [go-nuts] Reason to use different address space in gollvm

2021-07-08 Thread Kavindu Gimhan Zoysa
Hi Than, Thank you a lot for sharing this valuable information. It helps me a lot to understand this. Thank you, Kavindu On Wednesday, 7 July 2021 at 20:31:12 UTC+5:30 th...@google.com wrote: > Hi again, > > Sorry for the delay, I have been offline for a while. > > > You wrote: > >Regarding ad

Re: [go-nuts] Re: C Third Party Lib CGO

2021-07-08 Thread snmed
Thx Ian to pointing me to the documentation I read it, but still unsure regarding my example. Probably rule number 4 could apply, so let me go through my example and correct me if I'm wrong. 1. C.CreateApp() creates memory in C code and returns it as C void pointer 2. Go function CreateApp() re

Re: [External] Re: [go-nuts] build debug golang

2021-07-08 Thread Ian Lance Taylor
On Thu, Jul 8, 2021 at 8:41 PM 董⼀峰 wrote: > > Thanks for replying. > So golang only supports debugging optimized golang runtime? Well, Go requires that the runtime package be built with optimization (when using the gc compiler, which is the default). So, yes, when running runtime code under the

Re: [External] Re: [go-nuts] build debug golang

2021-07-08 Thread 董⼀峰
Thanks for replying. So golang only supports debugging optimized golang runtime? It is weird to me as a C++ developer. (T.T) Yifeng On Fri, Jul 9, 2021, 11:38 wrote: On Thu, Jul 8, 2021 at 7:43 AM Axis wrote: > > I am new in golang community. > I just want to build a debug golang to do better d

Re: [go-nuts] build debug golang

2021-07-08 Thread Ian Lance Taylor
On Thu, Jul 8, 2021 at 7:43 AM Axis wrote: > > I am new in golang community. > I just want to build a debug golang to do better debug. > But when I want to build debug golang using the following instructions > > " > export BOOT_GO_GCFLAGS="-N -l" > export BOOT_GO_LDFLAGS=

Re: [go-nuts] Re: C Third Party Lib CGO

2021-07-08 Thread Ian Lance Taylor
On Thu, Jul 8, 2021 at 10:09 AM snmed wrote: > > Thanks for your reply. I came across a similar solution today, I made a > struct which is visible outside the package and use a private field myApp > C.MyAppPtr to hide the C type. > I still wondering why the uintptr version works but shows a warn

[go-nuts] Re: Research on Go memory model and race detector

2021-07-08 Thread Amnon
Good luck with your thesis. It is worth looking at Russ Cox's blog, where he is giving Memory models his usual thorough treatment. https://research.swtch.com/mm. I suspect that memory models may be getting increased attention because of the increased usage of Arm processors, with more relaxed

Re: [go-nuts] Re: How to implement this in golang?

2021-07-08 Thread Brian Candler
Complete code on play.golang.org is much easier to understand. At the moment I don't think your code will do anything useful. For example buf := new(bytes.Buffer) ... bizz := buf.Bytes() will always set bizz to an empty slice; since you never modify

Re: [go-nuts] Re: How to implement this in golang?

2021-07-08 Thread Levieux Michel
This error is pretty straightforward 😅 You declared a variable (i.e. kk) that is not used after its declaration. Note that assignment is not use. I have to admit I don't know what this variable is supposed to be used for but that does not matter, if you don't know, maybe just try dropping it and se

Re: [go-nuts] Re: How to implement this in golang?

2021-07-08 Thread Kurtis Rader
The error is self explanatory. You define variable "kk" but never use it. If you don't care about the return value of io.Writer() simply omit the assignment; just call the function. Or explicitly assign to the special "_" placeholder var to show that you know the function returns a value and you ar

Re: [go-nuts] Re: How to implement this in golang?

2021-07-08 Thread LetGo
I thought that after getting the bytes, chunk the data, I need to have the io.writer back before send the chunked data So far I came up with this: ... cmd.Stdin = conn buf := new(bytes.Buffer) cmd.Stdout = buf bizz := buf.Bytes() var i int

[go-nuts] Re: C Third Party Lib CGO

2021-07-08 Thread snmed
Thanks for your reply. I came across a similar solution today, I made a struct which is visible outside the package and use a private field myApp C.MyAppPtr to hide the C type. I still wondering why the uintptr version works but shows a warning "possible misuse of unsafe.pointer", CGO documentat

[go-nuts] Re: C Third Party Lib CGO

2021-07-08 Thread Tamás Gulácsi
Use *C.MyAppPtr on Go side, don't hide it behind an uintptr. snmed a következőt írta (2021. július 7., szerda, 19:47:44 UTC+2): > > Hi all > > Once again I have a 3th party library which looks like this example: > https://play.golang.org/p/Ue9yQ8s8Ymq and I need it to integrate in our > go tool

[go-nuts] build debug golang

2021-07-08 Thread Axis
Hello everyone, I am new in golang community. I just want to build a debug golang to do better debug. But when I want to build debug golang using the following instructions " export BOOT_GO_GCFLAGS="-N -l" export BOOT_GO_LDFLAGS="-w" ./make.bash " golang j

Re: [go-nuts] derive encoder/decoder from std json encoder/decoder ?

2021-07-08 Thread Jan Mercl
On Thu, Jul 8, 2021 at 2:30 PM christoph...@gmail.com wrote: > I need to write a binary encoder/decoder very similar to the std JSON > encoder/decoder. > I would like to reuse 80% of the JSON encoder/decoder code and adapt it to > support my binary encoding. > > Is this allowed and at which con

[go-nuts] derive encoder/decoder from std json encoder/decoder ?

2021-07-08 Thread christoph...@gmail.com
I need to write a binary encoder/decoder very similar to the std JSON encoder/decoder. I would like to reuse 80% of the JSON encoder/decoder code and adapt it to support my binary encoding. Is this allowed and at which condition ? Would it be possible to publish my code on github with an MIT