[go-nuts] Re: basics of understanding golang memory usage

2020-08-17 Thread Mike Spreitzer
FYI, after asking on Slack I got some useful pointers: - https://golang.org/pkg/runtime/#MemStats - definitions of memory stats from the golang runtime - https://github.com/prometheus/client_golang/blob/master/prometheus/go_collector.go - the code that publishes golang runtime memory stats as

Re: [go-nuts] How to build an object file for a specific GOOS and GOARCH with external linker?

2020-08-17 Thread Ian Lance Taylor
On Sun, Aug 16, 2020 at 12:53 AM rotusm...@gmail.com wrote: > > i took your suggestions, tried the '-work' option it showed me the temporary > directory where the build files are stored, but they didn't contain the > object file. After exploring that a little, i found out out that the 'go >

Re: [go-nuts] [generics] Constraint type inference not working

2020-08-17 Thread Ian Lance Taylor
On Sun, Aug 16, 2020 at 7:42 AM jake...@gmail.com wrote: > > When I try the example from the "Constraint type inference" section of the > Draft Design: > https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#constraint-type-inference > it does not seem to

[go-nuts] Why was islibrary not set correctly when using -buildmode=c-shared with gccgo compiler

2020-08-17 Thread Yonatan Gizachew
Sorry I couldn't provide code to reproduce the case, but I just wanted to know if there are known cases for my issue. >From the golang source code, in the runtime library proc.go file there is this code snippet

[go-nuts] Re: basics of understanding golang memory usage

2020-08-17 Thread Mike Spreitzer
I collected data on an example program from four angles. See https://docs.google.com/document/d/1KUz7IjnD93X2VTVkRAhhNa7rHScCaIH8GLrsoaDIW_g for the raw data and my puny attempts to correlate the four views. There are some exact equalities, some near matches, some gross differences in things

Re: [go-nuts] Generics and parentheses

2020-08-17 Thread Frederik Zipp
jlge...@gmail.com schrieb am Montag, 17. August 2020 um 19:13:45 UTC+2: > >- No support covariance or contravariance. Maybe I am on shaky ground >in terms of my understanding but doesn't this mean, for instance, that if > I >have two interfaces, Foo and Bar, and a third composite

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread robert engels
See https://github.com/golang/go/issues/5045 which has been open for 7+ years. > On Aug 17, 2020, at 4:15 PM, Ian Lance Taylor wrote: > > On Mon, Aug 17, 2020 at 9:06 AM jake...@gmail.com wrote: >> >> My understanding is that atomic does not

[go-nuts] Why does x/tools/go/packages use `go list` under the hood?

2020-08-17 Thread Matt Mueller
Hi folks, I was looking into where my packages.Load time was being spent and I noticed that under the hood the packages library calls out to "go list" for information. I'm just wondering if there's any specific reason for this? It seems like fairly low-hanging fruit performance-wise to not

Re: [go-nuts] Re: What does "ex-wait-release" mean?

2020-08-17 Thread Ian Lance Taylor
On Mon, Aug 17, 2020 at 8:56 AM jake...@gmail.com wrote: > > See https://groups.google.com/g/golang-dev/c/qtxOW0x4Rrw/m/WqepX5V6AQAJ on > the golang-dev forum. It mean that it was wait-release but the tree is now > open for development. And the new tag helps us find CLs that were postponed

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread Brian Candler
Sorry, I should have been clearer: sync.atomic *does* synchronize the memory that it references. I didn't mean to imply that it synchronizes all memory. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread Ian Lance Taylor
On Mon, Aug 17, 2020 at 9:06 AM jake...@gmail.com wrote: > > My understanding is that atomic does not 'synchronize memory' in general. If > you use a Mutex, then everything that happened before is 'synchronized'. If > you use atomic then only the atomic variable is 'synchronized'. That is kind

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread robert engels
Sorry Ian, I see you included this - I was typing the message and replied without reading the refresh. > On Aug 17, 2020, at 6:59 PM, robert engels wrote: > > See https://github.com/golang/go/issues/5045 > which has been open for 7+ years. > >> On

[go-nuts] Re: Why does x/tools/go/packages use `go list` under the hood?

2020-08-17 Thread Matt Mueller
I think I got it. It looks like `go list` uses an internal cache to make its use really fast. Hopefully this package gets merged into the stdlib and we can take advantage of the cache directly! On Monday, August 17, 2020 at 11:22:52 PM UTC+2 Matt Mueller wrote: > Hi folks, > > I was looking

Re: [go-nuts] Generics and parentheses

2020-08-17 Thread Ian Lance Taylor
On Mon, Aug 17, 2020 at 10:13 AM Jonathan Gerber wrote: > > 1) Of the enumerated omissions, the ones that I think are really unfortunate > are, in order of importance, from my perspective: > > No operator methods & no adapters - Doesn't this make generic types sort of > second class?. I think

Re: [go-nuts] Generics and parentheses

2020-08-17 Thread Beka Westberg
> No support covariance or contravariance. Maybe I am on shaky ground in terms of my understanding but doesn't this mean, for instance, that if I have two interfaces, Foo and Bar, and a third composite interface, FooBar, which consists of Foo and Bar, that a function with a generic parameter T

[go-nuts] What does "ex-wait-release" mean?

2020-08-17 Thread Heisenberg
Some of my CLs are tagged with this, and I don't know why? Can someone please tell me? https://go-review.googlesource.com/c/go/+/244778 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread Jesper Louis Andersen
On Mon, Aug 17, 2020 at 12:54 PM leo.b...@npo-data.nl < leo.bal...@npo-data.nl> wrote: > Thanks. So I take it this must be handled by the compiler when generating > assembly. > > Yes. The compiler generally follows the Go Memory Model reference specification: https://golang.org/ref/mem > E.g. A

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread Jan Mercl
On Mon, Aug 17, 2020 at 12:55 PM leo.b...@npo-data.nl wrote: > Thanks. So I take it this must be handled by the compiler when generating > assembly. > > I have peeked in the src/cmd/compile/ directory , assuming it is hidden > there, but that's a rabbit hole I do want to go in just yet. > >

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread leo.b...@npo-data.nl
Thanks. So I take it this must be handled by the compiler when generating assembly. I have peeked in the src/cmd/compile/ directory , assuming it is hidden there, but that's a rabbit hole I do want to go in just yet. What I am really looking for is knowing which instructions lead to

Re: [go-nuts] Re: module confusion

2020-08-17 Thread 'K Richard Pixley' via golang-nuts
On 8/15/20 00:43, fge...@gmail.com wrote: On 8/15/20, Marvin Renich wrote: * Volker Dobler [200814 14:53]: On Friday, 14 August 2020 20:39:37 UTC+2, K Richard Pixley wrote: Isn't this the default location? I just untarred the distribution... No. There is a reason

Re: [go-nuts] Generics and parentheses

2020-08-17 Thread Jonathan Gerber
As someone who has spent a LOT of time in Rust, I really miss generics in Go (Conversely, i miss the simplicity of Go. My personal favorite, imaginary language would probably be Go + Generics + Sum Types and destructuring) and so I am really excited to see this taking shape. That being said,

[go-nuts] Re: What does "ex-wait-release" mean?

2020-08-17 Thread jake...@gmail.com
See https://groups.google.com/g/golang-dev/c/qtxOW0x4Rrw/m/WqepX5V6AQAJ on the golang-dev forum. It mean that it was wait-release but the tree is now open for development. On Monday, August 17, 2020 at 3:23:55 AM UTC-4 lziq...@gmail.com wrote: > Some of my CLs are tagged with this, and I

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread jake...@gmail.com
On Monday, August 17, 2020 at 11:19:16 AM UTC-4 b.ca...@pobox.com wrote: > On Monday, 17 August 2020 11:54:55 UTC+1, leo.b...@npo-data.nl wrote: >> >> E.g. A co-worker pointed out that you can avoid sync.Mutex by using this >> construct: >> >> if !atomic.CompareAndSwapInt32(, 0, 1) { >>

Re: [go-nuts] Re: module confusion

2020-08-17 Thread 'K Richard Pixley' via golang-nuts
On 8/17/20 08:41, fge...@gmail.com wrote: On 8/17/20, 'K Richard Pixley' via golang-nuts wrote: On 8/15/20 00:43, fge...@gmail.com wrote: On 8/15/20, Marvin Renich wrote: * Volker Dobler [200814 14:53]: On Friday, 14 August 2020 20:39:37 UTC+2, K Richard Pixley wrote: Isn't this the

Re: [go-nuts] Re: module confusion

2020-08-17 Thread fgergo
On 8/17/20, 'K Richard Pixley' via golang-nuts wrote: > On 8/15/20 00:43, fge...@gmail.com wrote: >> On 8/15/20, Marvin Renich wrote: >>> * Volker Dobler [200814 14:53]: On Friday, 14 August 2020 20:39:37 UTC+2, K Richard Pixley wrote: > Isn't this the default location? I just

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread leo.b...@npo-data.nl
Playing Devil's Advocate: https://golang.org/ref/mem says: > To serialize access, protect the data with channel operations or other synchronization primitives such as those in the sync and sync/atomic packages. So it

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread Brian Candler
On Monday, 17 August 2020 11:54:55 UTC+1, leo.b...@npo-data.nl wrote: > > E.g. A co-worker pointed out that you can avoid sync.Mutex by using this > construct: > > if !atomic.CompareAndSwapInt32(, 0, 1) { > fmt.Println("locked") > return > } >

[go-nuts] Re: Artistic Library for Go Programmers.

2020-08-17 Thread lgodio2
If you`re into C++ try Cimg ( https://cimg.eu/ )It's an excellent way to create your own images, fractals, artwork etc. but it does have a learning curve .. I also found Lode PNG quite usefu l https://lodev.org/lodepng/ but it requires a lot more additional code than Cimg On Sunday,