[go-nuts] go modules and ambiguous import, how to fix it?

2019-05-17 Thread Jérôme LAFORGE
Hello, I try to upate all dependencies from my module (go get -u), but I have a this error: build myModule: cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules: github.com/ugorji/go v1.1.4 (/home/user/myModule/pkg/mod/github.com

[go-nuts] Re: How to create reusable HTML components using default html/template package

2019-05-17 Thread Leonel Quinteros
I've created some approach for what you need, but designed to "compile" these templates and reusable components into a static site. Feel free to check the code for ideas to implement your own solution, it shouldn't be hard to do so: https://github.com/leonelquinteros/thtml I guess the code you

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Ian Lance Taylor
On Thu, May 16, 2019 at 5:24 AM Matt Layher wrote: > > I'm working on a project that involves an ioctl API on OpenBSD. The idea is > that you store a memory address in a union within another structure, and then > invoke the ioctl. When it returns, both the structure itself and the memory > poin

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Matt Layher
Hi Ian, Pointers passed to unix.Syscall or syscall.Syscall are always safe. > They will be treated as live for the duration of the call to Syscall, > and they will not be moved. This is a special exception for functions > written in assembly, documented at > https://golang.org/pkg/unsafe/#Poi

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Robert Engels
If Go ever adding a compacting collector I don't think these techniques would work - I would start with cgo as you will be protected then.-Original Message- From: Matt Layher Sent: May 17, 2019 9:44 AM To: golang-nuts Subject: Re: [go-nuts] Passing structures containing other pointers to

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Robert Engels
I only meant that if if the driver retains this pointers... In reading Ian's email, the top-level pointer will be retained and not collected, and it has references to the contained pointers.-Original Message- From: Robert Engels Sent: May 17, 2019 10:45 AM To: Matt Layher , golang-nuts Su

[go-nuts] Re: Go if else syntax .. suggested replacement

2019-05-17 Thread David Skinner
I consider this to be a non-issue. There are two ways of writing in a new language. - You can learn the language as defined. - You can write it the way you like it and convert to what is required and then convert every one else's stuff to what you like. Go makes it fairly easy for

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Matt Layher
It appears that the driver does not retain the internal pointers, but it also seems that my current use of Cgo is pretty unobtrusive (just malloc and friends) so I'm not too concerned about ridding myself of it either. - Matt On 2019-05-17 11:48 a.m., Robert Engels wrote: I only meant that if

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-17 Thread Marvin Renich
Sorry for the much delayed response. I have not had enough time lately! * Nitish Saboo [190508 05:48]: > "Do you mean "log/syslog" from the standard library? What does > initialize do?" > > >>I have installed syslog-ng parser on my Linux box and I am planning you > use syslog-ng parser and wan

[go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread madra
Spare a thought for those of us who actually speak and write 'proper' English and not that American version used in all programming languages. We get to write in our own language but have to remember to spell half the words wrong! > -- You received this message because you are subscribed to t

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Ian Lance Taylor
On Fri, May 17, 2019 at 7:44 AM Matt Layher wrote: > >> Pointers passed to unix.Syscall or syscall.Syscall are always safe. >> They will be treated as live for the duration of the call to Syscall, >> and they will not be moved. This is a special exception for functions >> written in assembly, doc

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Matt Layher
Thanks for the insight, this is very useful information. Perhaps I'll look into the mmap route. - Matt On Friday, May 17, 2019 at 12:54:28 PM UTC-4, Ian Lance Taylor wrote: > > On Fri, May 17, 2019 at 7:44 AM Matt Layher > wrote: > > > >> Pointers passed to unix.Syscall or syscall.Syscall are

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Jan Mercl
On Fri, May 17, 2019, 19:09 Matt Layher wrote: > Thanks for the insight, this is very useful information. Perhaps I'll look > into the mmap route. > Possibly useful: https://godoc.org/modernc.org/memory -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Michael Jones
I know that you joke here, but I had an interesting dinner conversation in London last year with erudite, scholarly friends who shared with me that recent research supports a different view of the "barbaric Americanised false English" that is the prevailing sentiment you share. According to the sc

Re: [go-nuts] the Dominance of English in Programming Languages

2019-05-17 Thread Andy Balholm
That’s probably true of the spoken language; American spelling, on the other hand, has changed more than British spelling. This is mostly a result of Noah Webster’s attempts to simplify it. King James Version Bibles generally follow the spelling of the 1769 Oxford printing, and the spelling is

[go-nuts] Re: go modules and ambiguous import, how to fix it?

2019-05-17 Thread Jérôme LAFORGE
How can I import this both modules without ambiguous? https://play.golang.org/p/YgrEmcTallk Thx for your help. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to g

Re: [go-nuts] the Dominance of English in Programming Languages

2019-05-17 Thread Jan Mercl
On Fri, May 17, 2019 at 10:51 PM Andy Balholm wrote: > That’s probably true of the spoken language; American spelling, on the other > hand, has changed more than British spelling. This is mostly a result of Noah > Webster’s attempts to simplify it. > > King James Version Bibles generally follow

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread stíobhart matulevicz
I know that a lot of what we think of as "American English" words are actually archaic forms of early 'English English'. Words like "gotten" instead of "got", for example. But there's also a lot of blame or credit (depending on your point of view) for the differences to be laid at the door o

Re: [go-nuts] Passing structures containing other pointers to ioctl: Go vs Cgo memory

2019-05-17 Thread Matt Layher
I ended up doing my own struct definition without the union (I only care about the pointer variant) so I could go along with what Ian suggested above: > It would be OK to pass a pointer to a struct to ioctl if the struct contains a pointer to other Go memory, but the struct field must have poi

[go-nuts] Re: go modules and ambiguous import, how to fix it?

2019-05-17 Thread t hepudds
I only took a brief look at this, but this seems to be a tricky one. You could try: go get github.com/ugorji/go/codec@none That made your example then work for me locally. >From the doc (https://golang.org/cmd/go/#hdr-Module_aware_go_get): "The version suffix @none indicates that th

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Michael Jones
In addition to being a daily Go programmer, I'm also a corporate executive in the US and a venture investment partner in the UK. This has me constantly surrounded by "proper" English and has made me very aware of the linguistic habits of my American upbringing. It seems that I've become an amalgam

[go-nuts] Re: go modules and ambiguous import, how to fix it?

2019-05-17 Thread t hepudds
Regarding that specific playground error, bradfitz kindly chimed in via a more concise forum: https://twitter.com/bradfitz/status/1129508420925644802 --

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Rob Pike
It is of course more complicated than most people believe. The right is often wrong; the wrong often has long precedence. The British -ise ending is an early 20th century misguided respelling based on invalid theories of etymology. Programme is just something that came out of the blue, from Scotlan

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Dan Kortschak
:) In Gonum source/text, we have a policy of ASE in user-facing documentation, but all my internal comments and commit messages are written in BE (though read by me in AuE). We also avoid usages that are ambigiguous when read in BE/AuE or grammatically incorrect when read in those dialects (the be

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Dan Kortschak
On Sat, 2019-05-18 at 09:43 +1000, Rob Pike wrote: > Australia is closer to Britain but sticks with jail > and tire. I don't think this is true Australia wide - in Melbourne and Adelaide (my home cities), I have always seen gaol and tyre. > I'm sure every English speaking country has its own set,

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Rob Pike
According to my Macquarie dictionary, the word in local use is jail but the established institutions still use the old spelling on their edifices. MacQ backs you on 'tyre', but I have seen 'tire' a lot as well. It continues to evolve. -rob On Sat, May 18, 2019 at 10:08 AM Dan Kortschak wrot

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread K.S. Bhaskar
And let's not forget Indian English - between the countries in the Indian Sub-continent (India, Pakistan, Nepal, Bangladesh), that should add up to another couple hundred million at least, with its own peculiarities like "Horn OK Tata" on the back of every truck (sorry, lorry). Interestingly, t

[go-nuts] Go linker efficiency

2019-05-17 Thread Tong Sun
Hi, How efficient Go linker is in detecting unused things (e.g., functions) in a package during build and remove them from the compiled binary? To extremely simplify the case, say - I have a package that contains 10 individual functions, and each of them will compile to 10K in binary size.

Re: [go-nuts] Go linker efficiency

2019-05-17 Thread Ian Lance Taylor
On Fri, May 17, 2019 at 9:12 PM Tong Sun wrote: > > How efficient Go linker is in detecting unused things (e.g., functions) in a > package during build and remove them from the compiled binary? > > To extremely simplify the case, say > > - I have a package that contains 10 individual functions, a