[go-nuts] Re: Is this bad concurrency?

2017-08-18 Thread Carl Mastrangelo
FYI: It is possible for `done` to never be sent to. For example consider the following sequence: goroutine: ch <- 1 main: <- 1 main: run defer main: fin = atomic load goroutine: atomic store main: not 1, return On Friday, August 18, 2017 at 11:13:36 AM UTC-7, bill@talentinc.com wrote:

[go-nuts] Puzzle: make a sync.Once fire more than once

2017-11-19 Thread Carl Mastrangelo
Hi gophers, I was playing around with a puzzle trying to break the sync package and found something cool. Can you think of a definition for f that causes once.Do to execute the argument more than once? package main import ( "sync" ) func main() { var once sync.Once var f = // .

[go-nuts] Is SizedReaderAt coming back in 1.8?

2016-09-08 Thread Carl Mastrangelo
It seems that io.SizedReaderAt was added temporarily during the 1.7 cycle, but promptly removed. I see an standing github issue for it (15822) but it doesn't seem to have much activity. I would like to express my hope that it comes back (and hopefully others will to). A use case that I am i

[go-nuts] Wrong order for float64 conversion

2016-10-13 Thread Carl Mastrangelo
https://play.golang.org/p/iZTogUaWWl In the program above, foo and bar compile but baz does not. It fails with the message: "invalid operation: 1 << b (shift of type float64)". This seems to be wrong on the surface, since the order of operations should imply the shift takes precedence. In th

Re: [go-nuts] Wrong order for float64 conversion

2016-10-13 Thread Carl Mastrangelo
erand alone. > So in your baz() example, because 1 is an untyped constant, the shift > expression acts as if 1 is the only operand and converts it to a float64 > type; therefore, 1 has type float64 and you cannot shift. To get around > this, just use an explicitly typed constant. &g

[go-nuts] Is testing.M safe to run multiple times?

2016-10-24 Thread Carl Mastrangelo
Is it safe to call (*testing.M).Run() multiple times within a single TestMain ? Whether the answer is yes or no, would it be possible to update the docs to make this clear? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from t

[go-nuts] How long are the results from runtime.Callers valid?

2016-08-06 Thread Carl Mastrangelo
TL;DR: Is the uintptr slice returned from runtime.Callers always valid? Reading the docs* for runtime.Callers says: "Callers fills the slice pc with the return program counters of function invocations on the calling goroutine's stack. " Does this imply that once the goroutine is gone, or all

Re: [go-nuts] How long are the results from runtime.Callers valid?

2016-08-06 Thread Carl Mastrangelo
Cgo is not in use; thank you for the quick response! On Saturday, August 6, 2016 at 11:49:22 AM UTC-7, Ian Lance Taylor wrote: > > On Sat, Aug 6, 2016 at 10:08 AM, Carl Mastrangelo > > wrote: > > TL;DR: Is the uintptr slice returned from runtime.Callers always valid? > &g

[go-nuts] [ANN] HTTP/2 Plaintext Server

2017-06-02 Thread Carl Mastrangelo
Hi all, If you have ever wanted to use the Go httputil.ReverseProxy with HTTP/2, or do HTTP/2 over Unix Domain Sockets, or do gRPC over plaintext, I made a package that makes it easy to do: https://github.com/carl-mastrangelo/h2c I added some examples to show how to do it, comments welcome

[go-nuts] Unsafe Pointer rules

2018-08-21 Thread &#x27;Carl Mastrangelo' via golang-nuts
(to short circuit any question, I have already read https://golang.org/pkg/unsafe/ ) If I create an unsafe.Pointer that points to an invalid memory address, but I never deference it or otherwise pass it along, what happens to it? Is it a valid go program to just create such a pointer? The mai

Re: [go-nuts] Unsafe Pointer rules

2018-08-21 Thread &#x27;Carl Mastrangelo' via golang-nuts
Tue, Aug 21, 2018 at 1:19 PM, 'Carl Mastrangelo' via golang-nuts > > wrote: > > > > If I create an unsafe.Pointer that points to an invalid memory address, > but > > I never deference it or otherwise pass it along, what happens to it? > > If you never

[go-nuts] syscall/js: How to pass data from the browser back into Go?

2018-10-05 Thread &#x27;Carl Mastrangelo' via golang-nuts
While trying out the Wasm compiler, I noticed that the syscall/js mainly has helper functions for converting Go types to Js types, but not the other way around. I am trying to read the data from an HTML . I add an event listener for the `change` event and want to read the file contents. The

[go-nuts] Can vet report useless assignments in method?

2018-10-22 Thread &#x27;Carl Mastrangelo' via golang-nuts
Hi go nuts, https://play.golang.org/p/ylYlbVMQ24- I recently hit an error where I had been calling methods on a struct. Originally, the fields in the struct were never changed, but after some iterations, i added some state to my struct. The methods which modified the state were always work