Re: [go-nuts] implicit initialization in golang declarations?

2020-02-10 Thread Kurtis Rader
On Mon, Feb 10, 2020 at 9:58 PM Alexander Mills wrote: > we can do this: > > var wg sync.WaitGroup > > > instead of having to write this: > > var wg sync.WaitGroup = sync.WaitGroup{} // is this initialization implicit, > and why? > > > > anyone know why, or what it's called? Is this intializati

[go-nuts] implicit initialization in golang declarations?

2020-02-10 Thread Alexander Mills
I have been confused about this ever since I started working with Go: https://gist.github.com/ORESoftware/a6243ce1039cea7e49a22ec8daf90a82 we can do this: var wg sync.WaitGroup instead of having to write this: var wg sync.WaitGroup = sync.WaitGroup{} // is this initialization implicit, and

Re: [go-nuts] Re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-10 Thread Ian Lance Taylor
On Mon, Feb 10, 2020 at 4:15 AM 'Axel Wagner' via golang-nuts wrote: > > It's reflect, so I don't feel confident in making any absolute statements > (we've talked about it a bunch; I just find the implications of that API far > too unwieldy to handle), but I tend to agree. You need a reference v

Re: [go-nuts] reflect.StructOf embedded base type with pointer type method set

2020-02-10 Thread Ian Lance Taylor
On Mon, Feb 10, 2020 at 10:09 AM Frank Rehwinkel wrote: > > It seems reflect.StructOf is not doing what the compiler does for first field > embedded base types with a pointer receiver method set. > > reflect.StructOf can't do a lot of things but other shortcomings are > documented or trigger pan

Re: [go-nuts] New tutorial series: Terminal-based Tetris - Part 1: Procedural polyomino generation

2020-02-10 Thread tslocum
Thanks for providing your feedback, Michael. I have updated the tutorial with additional diagrams everywhere it felt appropriate. Please let me know if you have other thoughts. On Monday, January 20, 2020 at 1:00:00 AM UTC-8, Michael Baldry wrote: > > This is cool but the post feels like you

[go-nuts] Re: Checking if two map variables refer to the same map

2020-02-10 Thread 'Kevin Regan' via golang-nuts
I just ran into this... ...makes me like go a little less. On Tuesday, August 7, 2018 at 6:34:03 AM UTC-7 mi...@daglabs.com wrote: > Sorry for bumping a very old thread, but I absolutely disagree with the > people stating that this problem is contrived, and I got here from a Google > search, s

Re: [go-nuts] Compilation fails when adding option "-trimpath", because change a dependency to require gcc

2020-02-10 Thread Vladimir Varankin
I faced the same problem lately. Have open an issue https://github.com/golang/go/issues/37158 On Thursday, February 6, 2020 at 8:53:03 AM UTC+1, Jérôme LAFORGE wrote: > > > I haven't verified this, so this is just a guess, but perhaps without >> -trimpath the go tool is using the prebuilt runtim

Re: [go-nuts] Sync.wait()?

2020-02-10 Thread Jesper Louis Andersen
There are two Wait() methods in the sync package. One is on the type Cond and one is on the type WaitGroup. Assuming you mean waitgroup, the code uses the runtime call Semacquire which is a semaphore lock. In that case, you are not looping anymore, but waiting until said semaphore is released. It

Re: [go-nuts] Why Discord is switching from Go to Rust

2020-02-10 Thread Kevin Chadwick
On 2020-02-10 16:31, Brian Candler wrote: > p.s. Does anyone know how well Rust reads as this is highly important to > me? > > > I have read Rust described as being in the spirit of "pragmatic Haskell". > > https://jmmv.dev/2018/07/rust-vs-go.html > https://jmmv.dev/series.html#Rust%20revie

[go-nuts] reflect.StructOf embedded base type with pointer type method set

2020-02-10 Thread Frank Rehwinkel
First, sorry for the long text. If this subject is of interest, one may want to skip to the code at the bottom. It seems reflect.StructOf is not doing what the compiler does for first field embedded base types with a pointer receiver method set. reflect.StructOf can't do a lot of things but oth

Re: [go-nuts] Re: Why Discord is switching from Go to Rust

2020-02-10 Thread t hepudds
Sorry, sending again after correcting a couple of typos. (That's what I get for trying to walk and chew gum at the same time or typing while distracted ;-) They had said they were generating almost no garbage. If that is true, I suspect they could have avoided the 2-minute forced GC by running

Re: [go-nuts] Re: Why Discord is switching from Go to Rust

2020-02-10 Thread t hepudds
They had said they were generating almost no garbage. If that is true, I suspect they could have avoided the 2-minute forced GC by running with GOGC=off, or alternatively executed SetGCPercent(-1) (https://golang.org/pkg/runtime/debug/#SetGCPercent) to disable the GC programmatically after reac

[go-nuts] Sync.wait()?

2020-02-10 Thread Joe McGuckin
Various sources say wait() waits until the internal counter reaches zero. Does it cause a real pause (e.g.: control passing to another goroutine?) Looking at the code, it just seems to loop endlessly waiting for the counter to reach zero. Is that somehow optimized away? Sitting in a tight loop

[go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2020-02-10 Thread prratnakar
Seed initialise default resource once for random method and using NewSource create different resources for random method On Wednesday, 27 March 2019 21:46:18 UTC+5:30, dja...@gmail.com wrote: > > Hi, > I think OP question actually is what is difference between: > r := rand.New(rand.NewSource(

Re: [go-nuts] Re: Why Discord is switching from Go to Rust

2020-02-10 Thread Jake Montgomery
runtime.GC() would not work for them. According to the docs - " GC runs a garbage collection and blocks the caller until the garbage collection is complete. It may also block the entire program." So that would be very counter productive in this case. On Monda

Re: [go-nuts] Why Discord is switching from Go to Rust

2020-02-10 Thread Brian Candler
On Monday, 10 February 2020 10:09:47 UTC, Kevin Chadwick wrote: > > p.s. Does anyone know how well Rust reads as this is highly important to > me? > I have read Rust described as being in the spirit of "pragmatic Haskell". https://jmmv.dev/2018/07/rust-vs-go.html https://jmmv.dev/series.html#Ru

Re: [go-nuts] godoc-static - Generate static documentation for your packages

2020-02-10 Thread tslocum
Hey Nick, I did consider that and hope to still visit it. I chose to scrape instead because the output requires only minimal alteration to achieve the desired result. Example code expansion is rewritten to not require JavaScript by using and and not much more. Large changes to output from t

Re: [go-nuts] godoc-static - Generate static documentation for your packages

2020-02-10 Thread Nick
Quoth tslo...@gmail.com: > Inspired by the recent news of godoc.org shutting down I have created > godoc-static.  While we could all migrate to pkg.go.dev, we could also host > and > update our documentation ourselves. Cool, sounds interesting, I like the idea of more tools to make more distribu

[go-nuts] vim-go autocompletion / help for struct members / function parameters

2020-02-10 Thread Johann Höchtl
I have a question about vim-go. Sorry if this is the wrong place, but opening a github issue feels wrong for that. I use vim-go autocompletion (a lot) in companion with gopls. I invoke it manually with ^C^O (omnicomplete) which is tied to gopls. I am not using deoplete. However, what I miss is

Re: [go-nuts] Re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-10 Thread 'Axel Wagner' via golang-nuts
It's reflect, so I don't feel confident in making any absolute statements (we've talked about it a bunch; I just find the implications of that API far too unwieldy to handle), but I tend to agree. You need a reference value and Bytes() seems the only typed reference value you can get out of reflect

[go-nuts] Re: Go-1.14 irreproducibly fails with mlock failure

2020-02-10 Thread Liam
You were bitten by a kernel bug; update your kernel. https://github.com/golang/go/issues/35777 On Sunday, February 9, 2020 at 10:48:29 AM UTC-8, Juliusz Chroboczek wrote: > > The first time I ran go-1.14rc1 on a stock Debian system, I got: > > runtime: mlock of signal stack failed: 12 >

Re: [go-nuts] Re: Dependency hierarchy in go

2020-02-10 Thread kuznetsov . alexey
On Monday, February 10, 2020 at 1:42:34 PM UTC+3, rog wrote: > > On Fri, 7 Feb 2020 at 19:47, > wrote: > >> >> >> On Friday, February 7, 2020 at 10:35:37 PM UTC+3, Jason Phillips wrote: >>> >>> Replace only works for the top-level go.mod. From the proposal doc (link >>>

Re: [go-nuts] Re: solving: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

2020-02-10 Thread roger peppe
On Sun, 9 Feb 2020 at 00:19, 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > (then again, the fact that this works seems slightly concerning to me: > https://play.golang.org/p/phWQ83wPQtx) > Oh, that's interesting! Is this the only way that you can use reflect (without unsa

Re: [go-nuts] Re: Dependency hierarchy in go

2020-02-10 Thread roger peppe
On Fri, 7 Feb 2020 at 19:47, wrote: > > > On Friday, February 7, 2020 at 10:35:37 PM UTC+3, Jason Phillips wrote: >> >> Replace only works for the top-level go.mod. From the proposal doc (link >> >> ): >> >>> Minimal ver

Re: [go-nuts] Re: Why Discord is switching from Go to Rust

2020-02-10 Thread Kevin Chadwick
On 2020-02-09 14:52, ffm2...@web.de wrote: > > Aside from that it would be nice if that 2-minutes GC trigger, that is > mentioned > in the text, could be removed or lessened. runtime.GC()? Though I recall that they found an alternative from the text? -- You received this message because you a

Re: [go-nuts] Why Discord is switching from Go to Rust

2020-02-10 Thread Kevin Chadwick
On 2020-02-09 15:05, David Riley wrote: > Correspondingly, the rather heavy requirements for the Go runtime make it a > lot less practical for small embedded use cases (though not impossible, as > recent list traffic indicates). If I were building a small (think <=256k > RAM) embedded system th