[go-nuts] Notable Go 1.8 XML decoder bug fix

2017-02-16 Thread James Pettyjohn
I switched to go 1.8 today and found that some of my XML parsing was failing where it was passing in 1.6/1.7. After a bit of searching I found that there was a bug that was *fixed* in 1.8 and my faulty data was previously being ignored. Specifically empty attributes which mapped to non-nilable

[go-nuts] Re: Organizing a lot of implementations for single interface

2017-02-16 Thread Henry
Alternatively, you can leave them where they are and focus on the future so that future implementation of the interface doesn't add to more garbage. It may be possible to use fewer data types with configurable behavior. -- You received this message because you are subscribed to the Google Group

[go-nuts] Panic when highly concurrent MySQL queries

2017-02-16 Thread Dave Cheney
Can you share that code, it looks like you haven't checked the error from the previous call. -- 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 golang-nuts+unsubscr

[go-nuts] Re: how to parse script expression with go and run the script

2017-02-16 Thread Jason E. Aten
Hello Hui, I would invite you try my scripting language, zygomys. It is 100% Go. It offers both (lisp) and {infix} syntax. https://github.com/glycerine/zygomys - Jason On Wednesday, February 15, 2017 at 12:48:32 AM UTC-6, hui zhang wrote: > > I am developing a game engine > I wish some event

[go-nuts] Go 1.8 is released

2017-02-16 Thread Chris Broadfoot
Hello gophers, We just released Go 1.8. You can read the announcement blog post here: https://blog.golang.org/go1.8 You can download binary and source distributions from our download page: https://golang.org/dl/ To compile from source using a Git checkout, update to the release with "git c

Re: [go-nuts] Re: weak hash for (MongoDb like) data server

2017-02-16 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 9:42 PM, Basile Starynkevitch wrote: > > On Wednesday, February 15, 2017 at 9:01:58 PM UTC+1, Tamás Gulácsi wrote: > >> >> Why do you need this? >> You want the GC do the housekeeping for you, but I'm sure you won't be >> happy with the result, as the GC's policy differs fr

Re: [go-nuts] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-16 Thread Dragos Harabor
I understand that, I was just curious to see if there was another way to do it besides reflection. On Thursday, February 16, 2017 at 12:03:43 PM UTC-8, Axel Wagner wrote: > > The question is: Why would you want to know? nil-pointers are perfectly > fine implementations of an interface. By caring

Re: [go-nuts] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-16 Thread 'Axel Wagner' via golang-nuts
The question is: Why would you want to know? nil-pointers are perfectly fine implementations of an interface. By caring whether the value implementing your interface is a nil-pointer, you are breaking the abstraction of your interface. On Thu, Feb 16, 2017 at 8:37 PM, Dragos Harabor wrote: > Act

Re: [go-nuts] "defer f.Close()" - error return ignored?

2017-02-16 Thread Jakob Borg
Deferred close on the input file is fine, no need for closure shenanigans. On the output file, you'll get cleaner code here by not using defer at all. outputFile, err := os.Create(outputFileName) if err != nil { return err } _, err = io.Copy(outputFile, inputFile) if e

Re: [go-nuts] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-16 Thread Dragos Harabor
Actually it doesn't do what I asked, sorry if I was not clear, I was expecting your example to print "true true", got excited too quickly. https://play.golang.org/p/WnDyT9OOpr On Thursday, February 16, 2017 at 11:32:59 AM UTC-8, Dragos Harabor wrote: > > Nice, thank you! > > On Thursday, Februa

Re: [go-nuts] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-16 Thread Dragos Harabor
Nice, thank you! On Thursday, February 16, 2017 at 11:25:31 AM UTC-8, Jan Mercl wrote: > > On Thu, Feb 16, 2017 at 8:20 PM Dragos Harabor > wrote: > > > Is there any way to check whether the value stored in a non-nil > interface is nil when you don't know the type, short of using > reflect.Valu

Re: [go-nuts] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-16 Thread Jan Mercl
On Thu, Feb 16, 2017 at 8:20 PM Dragos Harabor wrote: > Is there any way to check whether the value stored in a non-nil interface is nil when you don't know the type, short of using reflect.Value.IsNil()? For example: https://play.golang.org/p/Sdqx7Frjxj -- -j -- You received this message b

Re: [go-nuts] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-16 Thread Dragos Harabor
Is there any way to check whether the value stored in a non-nil interface is nil when you don't know the type, short of using reflect.Value.IsNil()? Thanks. On Wednesday, February 15, 2017 at 10:11:55 AM UTC-8, rog wrote: > > In addition to what others have said, note that the > comparison work

[go-nuts] Puzzle for golang guru.

2017-02-16 Thread DV
Very subtle fix: https://play.golang.org/p/xTEGpgIyP6 -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options,

[go-nuts] Puzzle for golang guru.

2017-02-16 Thread DV
Very subtle fix: https://play.golang.org/p/xTEGpgIyP6 -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options,

Re: [go-nuts] "defer f.Close()" - error return ignored?

2017-02-16 Thread Константин Изюмов
In my point of view - let`s try that: --- // Copy - copy files func Copy(inputFileName, outputFileName string) (err error) { if len(inputFileName) == 0 { return fmt.Errorf("inputFileName is zero: %s", inputFileName) } if len(outputFileName) == 0 { return f

[go-nuts] [ANN] Gobot 1.2 has been released

2017-02-16 Thread Ron Evans
Hi, everyone We just released Gobot (https://gobot.io) version 1.2 today, to coincide with the release party for Golang 1,8. Blog post here: https://gobot.io/blog/2017/02/16/gobot-1.2-released/ Thank you to everyone who contributed to this release! -- You received this message because you are

Re: [go-nuts] Panic when highly concurrent MySQL queries

2017-02-16 Thread lee
Ah thanks I had not seen this and replacing it with a non prepared version and some manual sql statement generation fixed the problem. Thank you! On Thursday, February 16, 2017 at 6:22:27 PM UTC, Justin Israel wrote: > > > > On Fri, Feb 17, 2017, 6:48 AM > wrote: > >> I have a channel that recei

Re: [go-nuts] Panic when highly concurrent MySQL queries

2017-02-16 Thread Justin Israel
On Fri, Feb 17, 2017, 6:48 AM wrote: > I have a channel that receives a lot of data that needs to be stored into > MySQL. > > After a short period of time I get the following... > > Error 1461: Can't create more than max_prepared_stmt_count statements > (current value: 16382) > panic: runtime err

[go-nuts] Re: Go 1.7.5 and Go 1.8rc3 are released

2017-02-16 Thread Jason E. Aten
On Thursday, February 16, 2017 at 9:50:22 AM UTC-6, Jason E. Aten wrote: > > Hi Chris, will go1.8 be released today? > I see the answer is yes. Woot! https://github.com/golang/go/releases/tag/go1.8?utm_source=golangweekly&utm_medium=email -- You received this message because you are subscribe

[go-nuts] Panic when highly concurrent MySQL queries

2017-02-16 Thread lee
I have a channel that receives a lot of data that needs to be stored into MySQL. After a short period of time I get the following... Error 1461: Can't create more than max_prepared_stmt_count statements (current value: 16382) panic: runtime error: invalid memory address or nil pointer dereferen

Re: [go-nuts] how can i build a golang system library of debug version

2017-02-16 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 11:29 PM, Wen Hailong <7234...@gmail.com> wrote: > i want to debug golang system library. can step code one by one Go programs are built with debugging info by default. You need to take special action to avoid the debugging info. But note https://golang.org/doc/gdb . You

Re: [go-nuts] Place of the Pointer type inside unsafe.package

2017-02-16 Thread Ian Lance Taylor
On Thu, Feb 16, 2017 at 8:50 AM, wrote: > Le jeudi 16 février 2017 17:46:15 UTC+1, Axel Wagner a écrit : >> >> The unsafe package is pretty much virtual. The compiler is aware of it and >> implements the operations defined by the spec to be in it. > > Is it the same for C.call() in the case of th

Re: [go-nuts] Place of the Pointer type inside unsafe.package

2017-02-16 Thread lael . cellier
Le jeudi 16 février 2017 17:46:15 UTC+1, Axel Wagner a écrit : > > The unsafe package is pretty much virtual. The compiler is aware of it and > implements the operations defined by the spec > to be in it. > Is it the same for C.call() in the case of th

Re: [go-nuts] Place of the Pointer type inside unsafe.package

2017-02-16 Thread 'Axel Wagner' via golang-nuts
The unsafe package is pretty much virtual. The compiler is aware of it and implements the operations defined by the spec to be in it. On Thu, Feb 16, 2017 at 6:54 AM, wrote: > Hello, > > I'm trying to redeclare the Pointer type > I found unsafe/unsafe

[go-nuts] Re: Organizing a lot of implementations for single interface

2017-02-16 Thread Luca Looz
It's a scraper and i'm already planning to drastically reduce implementations by grouping them into common ones that can be configured but i will not be able to do it for all of them Il giorno giovedì 16 febbraio 2017 17:14:34 UTC+1, Henry ha scritto: > > It's difficult to recommend any specific

[go-nuts] Re: Organizing a lot of implementations for single interface

2017-02-16 Thread Henry
It's difficult to recommend any specific refactoring strategy without seeing the actual codes. However, judging from your description where you have hundreds of implementation for a single interface, it just feels wrong and I am certain there is a way to simplify your codes. Instead of looking t

[go-nuts] Re: Puzzle for golang guru.

2017-02-16 Thread Volker Dobler
https://golang.org/doc/faq#nil_error Am Donnerstag, 16. Februar 2017 16:58:18 UTC+1 schrieb dreyk: > > What do you expect as output of following code? > > package main > > import "fmt" > > type MyInterface interface { >GetName() string > } > type MyInterfaceImpl struct { >Name stri

Re: [go-nuts] Puzzle for golang guru.

2017-02-16 Thread Rob Pike
https://golang.org/doc/faq#nil_error On Thu, Feb 16, 2017 at 12:38 AM, dreyk wrote: > What do you expect as output of following code? > > package main > > import "fmt" > > type MyInterface interface { >GetName() string > } > type MyInterfaceImpl struct { >Name string > } > func (

[go-nuts] Re: Orm Golang

2017-02-16 Thread dwicahya . sulistyawan
On Thursday, February 16, 2017 at 12:02:30 PM UTC+7, I Ketut Gunawan wrote: > > Hi is there any suggestion of using orm in golang with lock feature update > record ? > > > Thanks for help > Yang bisa dipergunakan : https://github.com/jinzhu/gorm -- You received this message because you

Re: [go-nuts] Field substitution in nested templates

2017-02-16 Thread brydavis . mpa
Still works as of Go 1.7 On Thursday, May 28, 2015 at 11:57:18 AM UTC-7, rog...@lommers.org wrote: > > Thanks; this fixed my problem! > > On Sunday, 29 April 2012 03:30:18 UTC+2, David Symonds wrote: >> >> You need to declare the data to use for the template invocation. You >> probably want >>

[go-nuts] Puzzle for golang guru.

2017-02-16 Thread dreyk
What do you expect as output of following code? package main import "fmt" type MyInterface interface { GetName() string } type MyInterfaceImpl struct { Name string } func (i *MyInterfaceImpl) GetName() string { return i.Name } func getNilMyInterface() MyInterface { re

[go-nuts] how can i build a golang system library of debug version

2017-02-16 Thread Wen Hailong
i want to debug golang system library. can step code one by one -- 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 golang-nuts+unsubscr...@googlegroups.com. For mor

[go-nuts] Place of the Pointer type inside unsafe.package

2017-02-16 Thread lael . cellier
Hello, I'm trying to redeclare the Pointer type I found unsafe/unsafe.go inside compiler source where the Pointer type is declared like this : type ArbitraryType int type Pointer *ArbitraryType. but obviously, this isn’t the declaration which used with Pointer() inside normal programs : package

[go-nuts] Re: Go 1.7.5 and Go 1.8rc3 are released

2017-02-16 Thread Jason E. Aten
Hi Chris, will go1.8 be released today? -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://

[go-nuts] Re: Organizing a lot of implementations for single interface

2017-02-16 Thread Luca Looz
Can you be more specific? Il giorno giovedì 16 febbraio 2017 14:36:19 UTC+1, Henry ha scritto: > > It seems like you could use some serious refactoring there, rather than > merely organizing your files. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Organizing a lot of implementations for single interface

2017-02-16 Thread Henry
It seems like you could use some serious refactoring there, rather than merely organizing your files. -- 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 golang-nuts

[go-nuts] Re: [ANN] Java Object Signing and Encryption (JOSE) for golang

2017-02-16 Thread dvsekhvalnov
Hi all, Want to make announcement on fixing possible security vulnerability in jose2go library. Invalid Curve Attack on NIST curves. So if you by chance using the library and dealing with ECDH key management, strongly advised to upgrade to latest (v1.3). -- You received this message because y

[go-nuts] Re: Windows Message Loop is getting blocked and resumed intermittently

2017-02-16 Thread martseniuk
Oh! Sorry about the wrong link. However dont ignore 2 errors from ole.GetMessage & ole.DispatchMessage On Thursday, February 16, 2017 at 1:45:18 PM UTC+3, fe f wrote: > > > https://github.com/go-ole/go-ole/blob/master/com.go#L308 > > I used this function. > > 2017년 2월 16일 목요일 오후 1시 30분 11초 UTC+9

[go-nuts] Re: empty nested template definitions not working as expected

2017-02-16 Thread Manlio Perillo
Il giorno mercoledì 15 febbraio 2017 19:36:40 UTC+1, mhh...@gmail.com ha scritto: > > Hi, > > see this play, > https://play.golang.org/p/s-GdewdWz_ > > In my understanding, > as the template is empty, > it is not added to the templates tree, > i suspect it has something to do with that, > https

[go-nuts] Re: Windows Message Loop is getting blocked and resumed intermittently

2017-02-16 Thread fe f
https://github.com/go-ole/go-ole/blob/master/com.go#L308 I used this function. 2017년 2월 16일 목요일 오후 1시 30분 11초 UTC+9, marts...@gmail.com 님의 말: > > check ole.GeMessage error. > > btw. https://github.com/go-ole/go-ole/blob/master/com_func.go#L163 > -- You received this message because you are su

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread caspian46
Thanks! I'm going to read it carefully. 在 2017年2月16日星期四 UTC+8下午4:40:54,Konstantin Khomoutov写道: > > On Thu, 16 Feb 2017 00:29:04 -0800 (PST) > casp...@gmail.com wrote: > > > > > Will GC close unused connection ? > > > > > > No. At least not directly. A finalizer can possibly do that and > > >

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread caspian46
Many thanks! Yes, I know that it is wrong to keep connection without call Close func. just when I working on a bug, I found the connection was closed automatically somehow. 在 2017年2月16日星期四 UTC+8下午4:33:54,Axel Wagner写道: > > Yes, in general, the GC will usually close connections when the > corre

Re: [go-nuts] go executable cross-compiled for arm5 works on amd64 (and arm5)

2017-02-16 Thread Dan Kortschak
Thank you. Yes, I had forgotten I'd installed that (needed for kernel building for the very same arm5 device). Dan On Thu, 2017-02-16 at 21:31 +1300, Michael Hudson-Doyle wrote: > Do you have qemu-user-static or a similarly named package installed? > Then > the magic of binfmt_misc may be invokin

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread Konstantin Khomoutov
On Thu, 16 Feb 2017 00:29:04 -0800 (PST) caspia...@gmail.com wrote: > > > Will GC close unused connection ? > > > > No. At least not directly. A finalizer can possibly do that and > > finalizers are possibly invoked by the GC. [...] > Means yes, GC will close unused connection, just indirectly? >

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread 'Axel Wagner' via golang-nuts
Yes, in general, the GC will usually close connections when the corresponding files are collected. But a) you can't really rely on that and b) the number of file descriptors that a program can open is very limited and for many programs, the rate at which they are opened is high enough, that they wi

Re: [go-nuts] go executable cross-compiled for arm5 works on amd64 (and arm5)

2017-02-16 Thread Michael Hudson-Doyle
Do you have qemu-user-static or a similarly named package installed? Then the magic of binfmt_misc may be invoking it. For me: $ cat /proc/sys/fs/binfmt_misc/qemu-arm enabled interpreter /usr/bin/qemu-arm-static flags: OC offset 0 magic 7f454c460101010002002800 mask ff0

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread caspian46
Thanks for you reply! Means yes, GC will close unused connection, just indirectly? Cause I found this: #/opt/go/src/net/fd_unix.go func (fd *netFD) setAddr(laddr, raddr Addr) { fd.laddr = laddr fd.raddr = raddr runtime.SetFinalizer(fd, (*netFD).Close) } And this function

[go-nuts] Re: Compressing 2.5 GB data trims files

2017-02-16 Thread Mukund 8kmiles
Hey all, Thanks, the io.copy resolved the issue. Thanks & Regards Mukund On Thu, Feb 16, 2017 at 2:51 AM, Dave Cheney wrote: > Or use https://godoc.org/io/ioutil#ReadFile > > By really you don't need to buffer all the data in memory, io.Copy will do > that for you > > in, err := os.Open(inpu