Re: [go-nuts] help with using crc32.Update for BE data.

2018-08-21 Thread Dan Kortschak
Question cross-posted to SO because crickets scare me. https://stackoverflow.com/questions/51960305/convert-crc32-sum-from- lsb-first-algorithm-to-sum-for-msb-first-algorithm On Sun, 2018-08-19 at 09:27 +0930, Dan Kortschak wrote: > I am working on an MPEG-TS-using package at the moment and need

Re: [go-nuts] os.StartProcess equivalent for exec (without fork)?

2018-08-21 Thread Caleb Spare
I *can* use syscall.Exec (really unix.Exec), and I am right now. The question was about avoiding all the boilerplate syscalls that go along with it that {os,syscall}.StartProcess take care of. Perhaps it would indeed be rarely used. I've wanted it at least twice, personally. It seems like the mai

Re: [go-nuts] Re: os.StartProcess equivalent for exec (without fork)?

2018-08-21 Thread Caleb Spare
On Tue, Aug 21, 2018 at 3:09 PM Manlio Perillo wrote: > On Wednesday, August 22, 2018 at 12:06:15 AM UTC+2, Manlio Perillo wrote: >> >> On Tuesday, August 21, 2018 at 9:50:23 AM UTC+2, Caleb Spare wrote: >>> >>> > > [...] > > >> >>> >> Here are two potential problems that I considered: >>> >>> 1.

Re: [go-nuts] Re: os.StartProcess equivalent for exec (without fork)?

2018-08-21 Thread Caleb Spare
On Tue, Aug 21, 2018 at 3:06 PM Manlio Perillo wrote: > On Tuesday, August 21, 2018 at 9:50:23 AM UTC+2, Caleb Spare wrote: >> >> I was recently trying to write a Go program that's something like chpst >> or setpriv: it execs another program with an altered process state by >> changing the user I

Re: [go-nuts] Unsafe Pointer rules

2018-08-21 Thread Ian Lance Taylor
On Tue, Aug 21, 2018 at 4:08 PM, 'Carl Mastrangelo' via golang-nuts wrote: > > The answer must be more nuanced than that, because it is possible to take a > nil pointer and construct an unsafe.Pointer from it. Yes, OK, nil is an exception, as it is for any pointer type. > The reason I am intere

Re: [go-nuts] Unsafe Pointer rules

2018-08-21 Thread 'Carl Mastrangelo' via golang-nuts
The answer must be more nuanced than that, because it is possible to take a nil pointer and construct an unsafe.Pointer from it. The reason I am interested in this is (and please don't judge too early) is I'm toying around with implementing some atomic primitives. In particular, I would like

Re: [go-nuts] Unsafe Pointer rules

2018-08-21 Thread Ian Lance Taylor
On 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 deference it and never do anything with it, then in practi

Re: [go-nuts] os.StartProcess equivalent for exec (without fork)?

2018-08-21 Thread Ian Lance Taylor
On Tue, Aug 21, 2018 at 12:49 AM, Caleb Spare wrote: > > I was recently trying to write a Go program that's something like chpst or > setpriv: it execs another program with an altered process state by changing > the user ID or modifying the ambient capabilities. (My program is > Linux-specific.) >

[go-nuts] Re: os.StartProcess equivalent for exec (without fork)?

2018-08-21 Thread Manlio Perillo
On Wednesday, August 22, 2018 at 12:06:15 AM UTC+2, Manlio Perillo wrote: > > On Tuesday, August 21, 2018 at 9:50:23 AM UTC+2, Caleb Spare wrote: >> >> > [...] > >> > Here are two potential problems that I considered: >> >> 1. Is exec-without-fork fundamentally at odds with Go and its runtime

[go-nuts] Re: os.StartProcess equivalent for exec (without fork)?

2018-08-21 Thread Manlio Perillo
On Tuesday, August 21, 2018 at 9:50:23 AM UTC+2, Caleb Spare wrote: > > I was recently trying to write a Go program that's something like chpst or > setpriv: it execs another program with an altered process state by changing > the user ID or modifying the ambient capabilities. (My program is > L

[go-nuts] Unsafe Pointer rules

2018-08-21 Thread '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

[go-nuts] Re: Concurrency Problems

2018-08-21 Thread T L
https://go101.org/article/channel-use-cases.html On Thursday, August 16, 2018 at 12:01:20 PM UTC-4, Rajat Jain wrote: > > Hi, > > I'm looking to solve interesting problems on concurrency in golang to > understand channels/goroutines better. Can anyone suggest a good > website/collection of probl

Re: [go-nuts] Re: What is the behavior of an HTTP persistent connection in Go?

2018-08-21 Thread Kevin Conway
> Are requests sent serially ... so that other concurrent requests to the same host are blocked When sending requests using HTTP/1, each connection will handle only one request at a time except when using pipelining. When sending requests using HTTP/2, each connection may manage any number of req

[go-nuts] os.StartProcess equivalent for exec (without fork)?

2018-08-21 Thread Caleb Spare
I was recently trying to write a Go program that's something like chpst or setpriv: it execs another program with an altered process state by changing the user ID or modifying the ambient capabilities. (My program is Linux-specific.) In Go, when you want to spawn another process (fork+exec in Posi