[go-nuts] Re: Oracle

2017-11-20 Thread calum . shawmackay
I've managed to get the installation of go-oci8 down to a fairly simple shell script. But it is difficult to get going at first. Here's a few pointers (off the top of my head - I'm not at work and don't have the actual script at hand) - Get Msys2 for windows, install it and update it with

[go-nuts] Re: is this safe?

2017-11-20 Thread Calum Shaw-Mackay
I tend to be quite careful around removing items from an array/slice/list and not just in Go. Deletion of items is probably the most mutable thing you can do to a list - if the list is shared between goroutines, it could really mess things up. Rather than delete, I'd suggest a mark and copy

[go-nuts] Re: is this safe?

2017-11-20 Thread nilton
Don't use that way. You can try that another approach: https://play.golang.org/p/Nu8zD1stOd Em segunda-feira, 20 de novembro de 2017 14:48:31 UTC-2, Trig escreveu: > > for i, user := range myList { > if user.Disabled { > myList = append(myList[:i], myList[i + 1:]...) // remove user from >

[go-nuts] Re: Should net.Conn transform function retain the original data segmentation?

2017-11-20 Thread Dave Cheney
Good point. I assumed the OP was talking about TCP. Yes, UDP breaks all the assumptions, but there isn't much that can be done about that now. On Monday, 20 November 2017 09:01:21 UTC-8, James Bardin wrote: > > Dave, should I then file a bug against net.UDPConn? ;) > > Though in this case I

Re: [go-nuts] Union types mindset

2017-11-20 Thread Josh Humphries
Hi, Paulo, I think you're on the right track. The main thing to note is that the IsInstruction method isn't that useful. A concrete implementation of AsmEntry is an instruction if it implements the Instruction interface, so you shouldn't need a separate method. So the example you provided looks

[go-nuts] Union types mindset

2017-11-20 Thread 'Paulo Matos' via golang-nuts
Hello, I am trying to write a simple assembler file parser. I just started developing in Go so I have the wrong mindset. I am keen to understand the best way to write something like this in Go. An assembler file at first glance is a list of instructions, directives and labels. I know there

Re: [go-nuts] is this safe?

2017-11-20 Thread dwahler
On Monday, November 20, 2017 at 11:32:34 AM UTC-6, Jan Mercl wrote: > > On Mon, Nov 20, 2017 at 5:48 PM Trig > wrote: > > > Is using append this way (to remove an index), inside of the range loop > of the same array I'm working with, safe... since the size of myList is >

Re: [go-nuts] Re: Should net.Conn transform function retain the original data segmentation?

2017-11-20 Thread James Bardin
On Mon, Nov 20, 2017 at 12:01 PM, James Bardin wrote: > Though in this case I assume you must be using a TCP connection, so there > is no concept of a "message" and hence to direct connection between the > write size and the read size. If something other than UDP is expecting

[go-nuts] Re: Should net.Conn transform function retain the original data segmentation?

2017-11-20 Thread James Bardin
Dave, should I then file a bug against net.UDPConn? ;) Though in this case I assume you must be using a TCP connection, so there is no concept of a "message" and hence to direct connection between the write size and the read size. If something other than UDP is expecting the full message in a

[go-nuts] is this safe?

2017-11-20 Thread Trig
for i, user := range myList { if user.Disabled { myList = append(myList[:i], myList[i + 1:]...) // remove user from return list } } Is using append this way (to remove an index), inside of the range loop of the same array I'm working with, safe... since the size of myList is being

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

2017-11-20 Thread Marvin Renich
* roger peppe [171120 09:35]: > This trick is used in the standard library (see net.http.envOnce.reset), and > for > testing purposes it's just about OK (though still dubious IMHO) but you should > never use it in production code, as you're writing atomic state with >

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

2017-11-20 Thread 'Axel Wagner' via golang-nuts
Note, that go vet catches this mistake: axelw@axelw-1 /tmp$ cat foo.go package main import ( "fmt" "sync" ) func main() { var once sync.Once var f func() times := 9 f = func() { if times == 0 { return } times-- fmt.Println("Called") oldonce := once * = sync.Once{} once.Do(f) once = oldonce }

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

2017-11-20 Thread Marvin Renich
* Carl Mastrangelo [171119 19:25]: > 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 ( >

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

2017-11-20 Thread roger peppe
This trick is used in the standard library (see net.http.envOnce.reset), and for testing purposes it's just about OK (though still dubious IMHO) but you should never use it in production code, as you're writing atomic state with non-atomic operations. On 20 November 2017 at 00:24, Carl

Re: [go-nuts] Oracle

2017-11-20 Thread Sanjay Banerji
Hello Jan:  Thanks for your prompt reply.  Will try again.  Will contact author after that if unsuccessful.  Yes, it is https://github.com/mattn/go-oci8 -  My inexpert guess is that there is some problem with how git is installed in my Windows pc.  Sanjay On 2017-11-18 22:26, Jan Mercl