[go-nuts] Re: Generics and readability

2017-08-25 Thread Viktor Kojouharov
func Foo(in interface{}) { val, ok := in.(someTypeOrInterface) if !ok { // TODO HANDLE ERROR } ... } Wow, this is so much more readable /s On Thursday, August 24, 2017 at 6:14:58 PM UTC+3, JuciÊ Andrade wrote: > > A lot of people like Go becau

[go-nuts] Re: Generics and readability

2017-08-25 Thread Egon
package tree type Node<$Entry> struct { Value $Entry Left *Node<$Entry> Right *Node<$Entry> } func (node *Node) Insert(value node.$Entry) { var side **Node if node.Value.Less(value) { side = &node.Right } else { side = &node.Left } if *side == nil { *side = &Node{Value: value} } else { (*side)

Re: [go-nuts] Re: Generics and readability

2017-08-25 Thread 'Axel Wagner' via golang-nuts
Maybe a loaded question but what is the goal of this thread? Is it to establish whether or not generics impact readability? In that case it should get a lot more civil and charitable on both sides. Anyway, my take on that: The examples mentioned, in a very real way, are not really suitable to disc

Re: [go-nuts] Should we stop using a global logger?

2017-08-25 Thread Henrik Johansson
Me neither but it can be very neat occasionally. Agreed and it also applies fine things like Tracing. But logger? If you change logger implementation you have to have a wrapper or you have to change the type conversions everywhere. Maybe refactoring tools can help I guess but I miss a common inter

[go-nuts] [ANN] go-apriltag: April tag image recognition for Go

2017-08-25 Thread Tom
My first attempt dealing with Cgo. https://github.com/twitchyliquid64/go-apriltag Really excited to do some funky image processing stuff. If anyone knows anything about 'homography matrices' let me know, I could use some help translating the homography matrix into euler angles (another feature

[go-nuts] Re: [golang-dev] Go 1.9 is released

2017-08-25 Thread Steven Hartland
Thanks for everyone's hard work on this! One thing I've noticed, having read through the blog post and release notes, is a mention of the issue with the netpoller is surprisingly absent. This issue has bitten us q

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Igor Maznitsa
and why the SDK is not presented in the list https://storage.googleapis.com/golang/ ? also under Ubuntu 16.04 LTS I have some error for any attempt to start Go 1.9 from downloaded SDK : */lib/ld-linux-aarch64.so.1: No such file or directory* I don't have any such error with the 1.8.3, is it nor

Re: [go-nuts] Should we stop using a global logger?

2017-08-25 Thread Tamás Gulácsi
I use "func(...interface{}) error" as the log func interface - that's what go-kit/kit/log provides without an explicit interface. Does not do much, easy to wrap into any logger but provides structural logging. With closures, sub-loggers are possible, too. -- You received this message because you

Re: [go-nuts] Should we stop using a global logger?

2017-08-25 Thread Peter Mogensen
On 2017-08-25 10:45, Henrik Johansson wrote: > Me neither but it can be very neat occasionally. > > Agreed and it also applies fine things like Tracing. > But logger? If you change logger implementation you have to have a > wrapper or you have to change the type conversions everywhere. But isn'

Re: [go-nuts] Should we stop using a global logger?

2017-08-25 Thread Henrik Johansson
Yes it works ok we have done it as well but a common interface wouldbe convenient. Especially when opentracing whose Go libs seems to take off nicely with afaik a common interface. Logging seems even simpler. I have started to use Zap pervasively and its typed API is very neat. fre 25 aug. 2017 k

Re: [go-nuts] Should we stop using a global logger?

2017-08-25 Thread Peter Mogensen
On 2017-08-25 12:53, Henrik Johansson wrote: > Yes it works ok we have done it as well but a common interface wouldbe > convenient. Especially when opentracing whose Go libs seems to take off > nicely with afaik a common interface. Logging seems even simpler. > > I have started to use Zap pervas

Re: [go-nuts] Re: Generics and readability

2017-08-25 Thread Henrik Johansson
Ah yes unfortunate that Ians proposal was rejected. fre 25 aug. 2017 kl 10:39 skrev 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com>: > Maybe a loaded question but what is the goal of this thread? Is it to > establish whether or not generics impact readability? In that case it > shou

[go-nuts] Re: Generics and readability

2017-08-25 Thread mhhcbon
In first example Value can not do Less, its Entry, Entry has not been defined yet, its nothing. Unless you introduce a Lesser interface and specify Node<$Entry:Lesser> Given that specific example this notation looks pretty heavy, and even worse if d that be As this is all scoped into a type def

Re: [go-nuts] Re: Generics and readability

2017-08-25 Thread mhhcbon
mh, what do you think of this quote ? Not to reject the whole work, just an example i stumble upon. ___ Note that type deduction requires types to be identical. This is stronger than the usual requirement when calling a function, namely that the types are assignable.

Re: [go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Konstantin Khomoutov
On Fri, Aug 25, 2017 at 02:05:52AM -0700, Igor Maznitsa wrote: > and why the SDK is not presented in the list > https://storage.googleapis.com/golang/ ? > also under Ubuntu 16.04 LTS I have some error for any attempt to start Go > 1.9 from downloaded SDK : > /lib/ld-linux-aarch64.so.1: No such

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread ojucie
Thank you, guys. Good job. -- 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://groups.google

Re: [go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Igor Maznitsa
>>The package search [1] turns up this file is provided by libc6 (for arm64). exactly, I just have downloaded arm64 distributive instead of amd64 :) , amd64 works well, I made the error because https://storage.googleapis.com/golang/ doesn't contain 1.9 and I have to load it manually -- You r

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich
One Liner for installing on Linux / Mac or other Unix like OS: (well almost) 1. Become root 2. cd /usr/local run this command: curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> /dev/null | tar zxvf - On Thursday, August 24, 2017 at 6:44:25 PM UTC-4, Chris Broadfoot wrote

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich
  9:20 AM (less than a minute ago)   One Liner for installing on Linux / Mac or other Unix like OS: (well almost) 1. Become root 2. cd /usr/local run this command: curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> /dev/null | tar zxvf - Just make sure you change the U

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich
 One Liner for installing on Linux / Mac or other Unix like OS: (well almost) 1. Become root 2. cd /usr/local run this command: curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> /dev/null | tar zxvf - Just make sure you change the URL to curl for the OS version you're wor

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich
 One Liner for installing on Linux / Mac or other Unix like OS: (well almost) 1. Become root 2. cd /usr/local run this command: curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> /dev/null | tar zxvf - Just make sure you change the URL to curl for the OS version you're wor

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich
One liner for installing on Linux. You can change the URL in the curl for other OS such as Mac, or any Unix like OS: cd $GOROOT;cd ..;curl https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz | sudo tar zxvf -;cd;/usr/local/go/bin/go version if you don't have GOROOT Set: cd /usr/loca

[go-nuts] Help! Same code, different results

2017-08-25 Thread Tong Sun
Hi, I'm experiencing a *very very* strange problem now -- the same Go code is producing different results *for me*. I'm not kidding, I can't believe that myself, so I've spent *the past few days* going back and forth to verify everything. Now, after all these days, the only conclusion that I

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread Konstantin Khomoutov
On Fri, Aug 25, 2017 at 08:39:29AM -0700, Tong Sun wrote: > I'm experiencing a *very very* strange problem now -- the same Go code is > producing different results *for me*. [...] > Can someone verify for me what you get please? > > go get github.com/go-dedup/fsimilar > > then > > cd go-ded

[go-nuts] Convert grid of colors to SVG

2017-08-25 Thread steve_bagwell
I've been experimenting with Go recently, having been more of a Python programmer. As an exercise, I've written a Go program that creates simple SVG xml based on a 2-dimensional grid of colors. I'm wondering if that's something worth putting up on Bitbucket or is there already a repo out there

Re: [go-nuts] Convert grid of colors to SVG

2017-08-25 Thread andrey mirtchovski
There's svgo: https://github.com/ajstarks/svgo When in doubt, put your code out there :) On Fri, Aug 25, 2017 at 9:37 AM, wrote: > I've been experimenting with Go recently, having been more of a Python > programmer. > As an exercise, I've written a Go program that creates simple SVG xml based >

Re: [go-nuts] Re: [golang-dev] Go 1.9 is released

2017-08-25 Thread Ian Lance Taylor
On Fri, Aug 25, 2017 at 1:53 AM, Steven Hartland wrote: > > One thing I've noticed, having read through the blog post and release notes, > is a mention of the issue with the netpoller is surprisingly absent. > > This issue has bitten us quite a bit, only tracked it down this week, so > would have

[go-nuts] [ANN] GemX: Generics For Go, Yet Again.

2017-08-25 Thread Ahmed (OneOfOne) W.
GenX is a project I've been working on and I'd like some feedback (code documentation and tests are lacking atm, working on that). I designed it to be as simple as possible while being able to handle advanced scenarios. For example, if the input file/package o

Re: [go-nuts] Convert grid of colors to SVG

2017-08-25 Thread steve_bagwell
Thanks Andrey, SVGO didn't seem to include that particular functionality. Maybe I just didn't look carefully enough? On Friday, August 25, 2017 at 12:32:25 PM UTC-4, andrey mirtchovski wrote: > > There's svgo: https://github.com/ajstarks/svgo > > When in doubt, put your code out there :) > > -

Re: [go-nuts] Convert grid of colors to SVG

2017-08-25 Thread andrey mirtchovski
I'm sorry, I assumed that you were looking for an SVG library. I think putting your code on bitbucket or elsewhere is a good idea. On Fri, Aug 25, 2017 at 11:18 AM, wrote: > Thanks Andrey, > SVGO didn't seem to include that particular functionality. Maybe I just > didn't look carefully enough?

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread Tong Sun
On Fri, Aug 25, 2017 at 12:09 PM, Konstantin Khomoutov wrote: > On Fri, Aug 25, 2017 at 08:39:29AM -0700, Tong Sun wrote: > > > I'm experiencing a *very very* strange problem now -- the same Go code is > > producing different results *for me*. > [...] > > Can someone verify for me what you get pl

[go-nuts] Getting the current process signal disposition

2017-08-25 Thread adam.azarchs via golang-nuts
TL;DR it would be nice if there were a public API to find the current signal disposition of your process. The runtime already stores that information in runtime.sigtable, but doesn't expose it. I ran into a gotcha with handling SIGHUP the other day. I need to handle SIGHUP in order to shut do

Re: [go-nuts] Generics and readability

2017-08-25 Thread Jesper Louis Andersen
On Thu, Aug 24, 2017 at 5:14 PM wrote: > func (r genType1) f(x, y genType2) (z getType2, err > error) > > In a language such as OCaml, you would define `f` as: let f r (x, y) = ... And the system would infer the type of `f` automatically. In your case it would probably infer something like v

[go-nuts] https://golang.org/pkg/builtin/#append

2017-08-25 Thread mhhcbon
looks broken here __ File builtin builtin /src/builtin/builtin.go:88:11: expected type, found '=' (and 1 more errors) -- 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

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread Tong Sun
Update, On Fri, Aug 25, 2017 at 11:39 AM, Tong Sun wrote: > Hi, > > I'm experiencing a *very very* strange problem now -- the same Go code is > producing different results *for me*. > I'm not kidding, I can't believe that myself, so I've spent *the past few > days* going back and forth to verif

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread mhhcbon
[mh-cbon@pc2 rendez-vous] $ cd ../../go-dedup/fsimilar/ [mh-cbon@pc2 fsimilar] $ find test/sim -type f | ./fsimilar -i -d 12 -vv [fsimilar] n='GNU - 2001 - Python Standard Library', e='.pdf', s='1', d= 'test/sim/' [fsimilar] +: Simhash of 55d4263ae1a6e6d6 added. [fsimilar] n='(eBook) GNU - Python

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread Egon
Try to find the first place where the processes diverge: 1. maybe find lists files in different order 2. maybe something read input does things in different order 3. maybe some processing uses maps --> hence random order 4. etc... (of course run with -race, if you already haven't) On Friday, 25

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread Tong Sun
Thanks a lot my friend. That's something I'm afraid of. On Fri, Aug 25, 2017 at 3:02 PM, wrote: > [mh-cbon@pc2 rendez-vous] $ cd ../../go-dedup/fsimilar/ > [mh-cbon@pc2 fsimilar] $ find test/sim -type f | ./fsimilar -i -d 12 -vv > [fsimilar] n='GNU - 2001 - Python Standard Library', e='.pdf',

[go-nuts] Re: const vs global variables in go

2017-08-25 Thread T L
On Wednesday, August 23, 2017 at 8:49:39 AM UTC-4, Alkesh Ghorpade wrote: > > Hi All, > > I am new to Go and trying to figure out difference between const vs var > variables memory usage and initialization. > > I have following go code > // way 1 > var a = []string{"abc", "def"} > > // way 2 > c

[go-nuts] can't use text filename on open that was read from stdin

2017-08-25 Thread Geoff Fridd
When I use a literal as the filename in an os.Open statement it works. When I use a variable defined as text as the filename, it works. When I read in the text filename from stdin, it doesn't work. Why is that? What do I need to do to make it work? See attached text file. -- You received this

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread Tong Sun
[resent to group, sorry Egon] On Fri, Aug 25, 2017 at 3:04 PM, Egon wrote: > Try to find the first place where the processes diverge: > > 1. maybe find lists files in different order > Oh, YES! BINGO! THANKS A LOT. find test/sim -type f* | sort* | ./fsimilar -i -d 12 -vv gave me the correct o

[go-nuts] Re: can't use text filename on open that was read from stdin

2017-08-25 Thread mhhcbon
someone did answer you in your earlier thread, but here you go https://play.golang.org/p/VVTXPhSYPE On Friday, August 25, 2017 at 9:18:18 PM UTC+2, Geoff Fridd wrote: > > When I use a literal as the filename in an os.Open statement it works. > When I use a variable defined as text as the file

Re: [go-nuts] Getting the current process signal disposition

2017-08-25 Thread Ian Lance Taylor
On Fri, Aug 25, 2017 at 11:09 AM, adam.azarchs via golang-nuts wrote: > TL;DR it would be nice if there were a public API to find the current signal > disposition of your process. The runtime already stores that information in > runtime.sigtable, but doesn't expose it. > > I ran into a gotcha wit

Re: [go-nuts] https://golang.org/pkg/builtin/#append

2017-08-25 Thread Ian Lance Taylor
On Fri, Aug 25, 2017 at 11:28 AM, wrote: > looks broken here > > __ > > File builtin > > builtin > > /src/builtin/builtin.go:88:11: expected type, found '=' (and 1 more errors) https://golang.org/issue/21601 Ian -- You received this message because you are subscribed to the Google

Re: [go-nuts] Re: [golang-dev] Go 1.9 is released

2017-08-25 Thread Steven Hartland
On 25/08/2017 17:39, Ian Lance Taylor wrote: On Fri, Aug 25, 2017 at 1:53 AM, Steven Hartland wrote: One thing I've noticed, having read through the blog post and release notes, is a mention of the issue with the netpoller is surprisingly absent. This issue has bitten us quite a bit, only trac

[go-nuts] Re: OT: (NOOB) Settings GOROOT and GOPATH on Freebsd

2017-08-25 Thread mrpa . android
I found a solution that solved my problem, now using FreeBSD 11.1 x86_64 Nginx Reverse Proxy and Golang Setup on FreeBSD Source: https://www.vultr.com/docs/nginx-reverse-proxy-and-golang-setup-on-freebsd Requirements Basic knowledge of UNIX. FreeBSD x64 with Nginx installed. Install Tools Yo

[go-nuts] go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread lukas.malkmus via golang-nuts
I'm using helper functions in my test, for example this one: // assert fails the test if the condition is false. func assert(tb testing.TB, condition bool, msg string, v ...interface{}) { if !condition { _, file, line, _ := runtime.Caller(1) fmt.Printf("\033[31m%s:%d: "+msg+"\033[39m\n\n", appe

Re: [go-nuts] go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread Caleb Spare
Oh, shoot. It should be part of the interface. That was part of the proposal: https://github.com/golang/proposal/blob/master/design/4899-testing-helper.md but I forgot to add it. On Fri, Aug 25, 2017 at 1:16 PM, lukas.malkmus via golang-nuts < golang-nuts@googlegroups.com> wrote: > I'm using he

Re: [go-nuts] go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread Caleb Spare
I filed https://github.com/golang/go/issues/21627. Thanks for the heads up. On Fri, Aug 25, 2017 at 1:39 PM, Caleb Spare wrote: > Oh, shoot. It should be part of the interface. That was part of the > proposal: > > https://github.com/golang/proposal/blob/master/design/ > 4899-testing-helper.md >

[go-nuts] Re: go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread lukas.malkmus via golang-nuts
It is part of the interface... Am Freitag, 25. August 2017 22:35:21 UTC+2 schrieb lukas@googlemail.com: > > I'm using helper functions in my test, for example this one: > > // assert fails the test if the condition is false. > func assert(tb testing.TB, condition bool, msg string, v ...interfa

Re: [go-nuts] Re: go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread Caleb Spare
Yeah, sorry, I misread the report. I can't reproduce the issue. Can you give a complete runnable example. On Fri, Aug 25, 2017 at 1:46 PM, lukas.malkmus via golang-nuts < golang-nuts@googlegroups.com> wrote: > It is part of the interface... > > > Am Freitag, 25. August 2017 22:35:21 UTC+2 schrie

[go-nuts] Re: can't open file if its name was read from stdin

2017-08-25 Thread Geoff Fridd
I found the solution myself - when read in from stdin, there are 2 extra characters - CR and LF. I just cut the string 2 characters before the end, and it works! Thanks to those for posting replies! On Thursday, August 24, 2017 at 11:35:31 PM UTC-4, Geoff Fridd wrote: > > Does anyone know why

[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread ahhb1965
Just wanted to thank everyone who made this 10th release possible ! Great work to common and my personal benefit ! Thank You ! Andreas On Friday, 25 August 2017 00:44:25 UTC+2, Chris Broadfoot wrote: > > Hello gophers, > > We just released Go 1.9. > > > > Thanks to everyone who contribut

[go-nuts] Re: go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread lukas.malkmus via golang-nuts
package bug // Pow returns x raised to the power of y i.e. x^y. func Pow(x, y int) int { return x ^ y } package bug_test import ( "fmt" "testing" "github.com/lukasmalkmus/bug" ) func TestPow(t *testing.T) { tests := []struct { x, y, z int }{ {0, 0, 0}, {1, 0, 1}, {0, 1, 11}, } for _, tt := ra

[go-nuts] Re: go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread lukas.malkmus via golang-nuts
I'm sorry, I think I made a huge mistake. The malicious output only occurs when running go test with the -race flag. Am Freitag, 25. August 2017 22:35:21 UTC+2 schrieb lukas@googlemail.com: > > I'm using helper functions in my test, for example this one: > > // assert fails the test if the co

[go-nuts] Golang 1.9 failing with excelize (simple case works under 1.8.3)

2017-08-25 Thread G Shields
Under 1.8.3 the program run: package main import ( "fmt" "os" "strconv" "github.com/Luxurioust/excelize" ) func checkErr(err error) { if err != nil { fmt.Println(err) os.Exit(1) } } func main() { xlsx, err := excelize.OpenFile("test.xlsx") checkE

Re: [go-nuts] Re: go 1.9: New Helper() method in testing package does not work with testing.TB interface

2017-08-25 Thread Caleb Spare
That's not a mistake. It's still a bug! Just doesn't seem like a very severe one. I filed https://github.com/golang/go/issues/21631. On Fri, Aug 25, 2017 at 3:08 PM, lukas.malkmus via golang-nuts < golang-nuts@googlegroups.com> wrote: > I'm sorry, I think I made a huge mistake. The malicious outp

Re: [go-nuts] Should we stop using a global logger?

2017-08-25 Thread Ian Ross
I have fiound when you start tracing (e.g jaeger by Uber), you start logging properly and realise it should only used when something needs to be done by an admin. On Friday, August 25, 2017 at 12:00:38 PM UTC+1, Peter Mogensen wrote: > > > > On 2017-08-25 12:53, Henrik Johansson wrote: > > Yes

[go-nuts] Re: can't open file if its name was read from stdin

2017-08-25 Thread Uli Kunitz
Good, that you found the problem yourself. I wasn't aware that you were on Windows were newlines are represented by CRLF ("\r\n"). TrimSpace would deal with that as well. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Lazy Bash redirection

2017-08-25 Thread juicemia
Hi everybody. I don't know if this question has been asked before, partially because I don't really even know what to call what I'm trying to do. The best I can come up with is that I'm trying to do lazy redirection in bash but I'm having some trouble. A concrete example should help explain:

Re: [go-nuts] Re: Go 2 suggestion - Types like "int?"

2017-08-25 Thread gurpartap
Relevant Tweet: https://twitter.com/casio_juarez/status/900374362401914881 On Wednesday, August 23, 2017 at 1:42:07 AM UTC+5:30, Joe Tsai wrote: > > What you are asking for is captured in https://golang.org/issue/7054 > > On Tuesday, August 22, 2017 at 12:28:41 PM UTC-7, Steven Blenkinsop wrote: >