Re: [go-nuts] UML && Golang, part 2 ?

2021-07-05 Thread Henry
UML is a design language. You can use it to express ideas and concepts regardless your programming languages, and to communicate those ideas to other people. Just like any other tools, you can use it in your projects as you see fit. Many people have moved into a more agile-like development proc

Re: [go-nuts] Profiling a CGO application - pprof alternatives

2021-07-05 Thread Ian Lance Taylor
On Mon, Jul 5, 2021 at 4:24 PM 'Tal Lichtenstein' via golang-nuts wrote: > > I am trying to pinpoint a performance issue with a go package that uses a > large 3rd party C++ library we interface with using CGO. > > Tried these options: > > 1. Go profiler - doesn't see anything beyond function runt

[go-nuts] Profiling a CGO application - pprof alternatives

2021-07-05 Thread 'Tal Lichtenstein' via golang-nuts
I am trying to pinpoint a performance issue with a go package that uses a large 3rd party C++ library we interface with using CGO. Tried these options: 1. *Go profiler* - *doesn't see anything beyond function runtime.cgocall. *This has already been discussed here

Re: [go-nuts] parameter type of strings.NewReplacer

2021-07-05 Thread Ian Lance Taylor
On Mon, Jul 5, 2021 at 4:00 PM 'nadashin' via golang-nuts wrote: > > What is the purpose of having, > > func NewReplacer(oldnew ...string) *Replacer > > instead of, > > func NewReplacer(oldnew ...[2]string) *Replacer It's easier to both write and read r := strings.NewReplacer("old1", "new

[go-nuts] parameter type of strings.NewReplacer

2021-07-05 Thread 'nadashin' via golang-nuts
What is the purpose of having, func NewReplacer(oldnew ...string) *Replacer instead of, func NewReplacer(oldnew ...[2]string) *Replacer -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving email

Re: [go-nuts] Re: ioutil.ReadAll()

2021-07-05 Thread ANKIT KUMAR
resp, err := http.Get("http://example.com/";) if err != nil { // handle error } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) That err returned from ReadAll. how to sloved On Saturday, February 17, 2018 at 2:23:10 PM UTC+5:30 patri...@gmail.com wrote: > > Den 2018-02-14 kl. 1

[go-nuts] Re: Does go:embed embed.FS embeds directories or possible confusion with how it works

2021-07-05 Thread Sean Liao
`embed` embeds the files with the path you specified, so if you look into your `static` variable, the files will be available as `files/static/yourfile`. This means there won't be issues with filename collisions etc... if you specify multiple patterns If you want to serve your files in your `fi

[go-nuts] Re: Does go:embed embed.FS embeds directories or possible confusion with how it works

2021-07-05 Thread Amnon
What does go list -f '{{ .EmbedFiles }}' display? On Monday, 5 July 2021 at 06:28:54 UTC+1 tjgur...@gmail.com wrote: > Hi there, > > I have been testing the (relatively) new go:embed feature for a few days > and I came across this situation which I wasn't quite sure what was causing > it so I

Re: [go-nuts] UML && Golang, part 2 ?

2021-07-05 Thread Jeremy French
I wouldn't think that UML is unpopular, so much as it's not as helpful as other languages. UML is especially useful in OOP, which Go is not, at least not specifically. And I also think UML can tend to push you into certain paradigms of thinking or design patterns, whereas maybe Go tends to have

Re: [go-nuts] How I can see My Go code + Compiler generated Go source code -- before a point of assembly?

2021-07-05 Thread Ian Lance Taylor
On Mon, Jul 5, 2021 at 12:59 AM FallingFromBed wrote: > > To give an example, for C++ we have https://cppinsights.io/ and I am not > asking for any web based tools as such Any native cmd (go tool) > available to achieve what I am looking for? Thanks. I'm not aware of any such tools for Go,

[go-nuts] Finding a small memory leak

2021-07-05 Thread Christian Worm Mortensen
I want to hear if anybody has an idea on how I can find a very small memory leak in a Go program? The program is a service running for days and weeks. I am not even 100% sure there is a memory leak, but when I look at the memory usage graphs based on data from runtime.ReadMemStats it looks l

Re: [go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread Erman İmer
Awesome, thanks! On Mon, Jul 5, 2021 at 2:11 PM Axel Wagner wrote: > FWIW writing to a channel non-blockingly works like this: > > select { > case ch <- v: > default: > } > > If no communication can proceed (i.e. the write would block) the default > case is chosen. > > On Mon, Jul 5, 2021 at 1:0

Re: [go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread 'Axel Wagner' via golang-nuts
FWIW writing to a channel non-blockingly works like this: select { case ch <- v: default: } If no communication can proceed (i.e. the write would block) the default case is chosen. On Mon, Jul 5, 2021 at 1:09 PM Erman İmer wrote: > Thank you! I was confused about the highlighted part "For a ch

Re: [go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread Erman İmer
Thank you! I was confused about the highlighted part "For a channel used for notification of *just one* signal value, a buffer of size 1 is sufficient.*" *But I am convinced after realizing the single read on the 289th line. I will also spend some time understanding how Notify writes signals non-bl

Re: [go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread 'Axel Wagner' via golang-nuts
The documentation is actually very specific here: Package signal will not block sending to c: the caller must ensure that c > has sufficient buffer space to keep up with the expected signal rate. *For > a channel used for notification of just one signal v

Re: [go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread 'Axel Wagner' via golang-nuts
On Mon, Jul 5, 2021 at 12:41 PM Erman İmer wrote: > I think it is not about the context's cancellation. The signal channel > should have a sufficient buffer size. > 1 is a sufficient buffer size. Note that there is *exactly one* read from c.ch in https://github.com/golang/go/blob/912f0750472dd4f

Re: [go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread Erman İmer
Another former discussion: https://github.com/golang/lint/issues/175 On Mon, Jul 5, 2021 at 1:41 PM Erman İmer wrote: > I think it is not about the context's cancellation. The signal channel > should have a sufficient buffer size. > > Please check the former discussion which determined the Notif

Re: [go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread Erman İmer
I think it is not about the context's cancellation. The signal channel should have a sufficient buffer size. Please check the former discussion which determined the Notify function's description. https://github.com/dominikh/go-staticcheck/issues/30 Best regards On Mon, Jul 5, 2021 at 1:28 PM Sea

[go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread Sean Liao
What problem are you trying to solve? It only makes sense for NotifyContext to receive a single signal since a context can only be cancelled once On Monday, July 5, 2021 at 10:17:49 AM UTC+2 erma...@gmail.com wrote: > Sorry about the broken link, here is the line: > > https://github.com/golang/g

[go-nuts] Re: Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread erma...@gmail.com
Sorry about the broken link, here is the line: https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/signal/signal.go#L284 On Monday, July 5, 2021 at 11:15:11 AM UTC+3 erma...@gmail.com wrote: > Hello, > > I have an improvement idea for the following line in the os/sig

[go-nuts] Fixed channel capacity in NotifyContext function in os/signals package

2021-07-05 Thread erma...@gmail.com
Hello, I have an improvement idea for the following line in the os/signals package. 284 c.ch = make(chan os.Signal, 1) Regarding the underlying functi

Re: [go-nuts] UML && Golang, part 2 ?

2021-07-05 Thread Vladimir Varankin
For the current system, that concists of <100 µ-services (the whole system is owned by one team), I'm trying to evaluate C4 model https://c4model.com. TBF, this is an ongoing experiment for myself, and I don't try to strictly follow the C4's nomenclature, but I find the idea of zooming-in & zoo

[go-nuts] How I can see My Go code + Compiler generated Go source code -- before a point of assembly?

2021-07-05 Thread FallingFromBed
To give an example, for C++ we have https://cppinsights.io/ and I am not asking for any web based tools as such Any native cmd (go tool) available to achieve what I am looking for? Thanks. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

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

2021-07-05 Thread Kavindu Gimhan Zoysa
Hi, Regarding address spaces, I saw that there is a pass to remove address space casts. But if I generate IR using `*llvm-goc -dump-ir -enable-gc=1 test.go*` for the following go file, I still can see the *addrspacecast* instruction. What is the reason to see that *addrspacecast? *I feel that