[go-nuts] Re: Go eval the source

2017-07-21 Thread Nathan Kerr
A couple other options: 1. modify your code, compile, run 2. put most of your code in main.go, each specific sort method in a separate file (e.g., specific.go) so that go run main.go specific.go will use the sorting you need. See https://pocketgophers.com/10-to-instrument/ for an example of thi

Re: [go-nuts] Re: Going places

2017-07-21 Thread Michael Jones
I suspected it was not a first but i wanted to make sure the go team knew of the use. "for..range" mages for clear pseudocode. On Fri, Jul 21, 2017 at 4:40 PM, Brian Ketelsen wrote: > Congrats - that's awesome - I beat you by a few years though :) > > > > On Friday, July 21, 2017 at 12:03:03 PM

[go-nuts] Re: Going places

2017-07-21 Thread Brian Ketelsen
Congrats - that's awesome - I beat you by a few years though :) On Friday, July 21, 2017 at 12:03:03 PM UTC-4, Michael Jones wrote: > > Maybe not news, and certainly not big news, but I just filed a patent that > uses Go source code to illustrate logical methods claimed in the invention. > So

[go-nuts] Re: No Allman-Style, No go!

2017-07-21 Thread Dave Cheney
Thank you for keeping the dream of this thread alive. -- 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] Go eval the source

2017-07-21 Thread Tong Sun
Hi, I've done some searching before posting, so I know there are a few packages out there that can do go eval, but am wondering which one best suits the following purpose -- I want to sort JSON array using Go, because each case would be different for the different JSON arrays that I'm sorting

[go-nuts] Re: No Allman-Style, No go!

2017-07-21 Thread ecstatic . coder
That's the problem. Indentation style should remain personal, as it's a matter of taste. Every development team should have the right to freely choose which coding standard they will enforce. On Friday, July 21, 2017 at 3:22:50 PM UTC+1, Hrobjartur Thorsteinsson wrote: > > Best just to call th

Re: [go-nuts] Going places

2017-07-21 Thread Henrik Johansson
I am feeling slightly ambivalent but cool and congrats! fre 21 juli 2017 kl 18:02 skrev Michael Jones : > Maybe not news, and certainly not big news, but I just filed a patent that > uses Go source code to illustrate logical methods claimed in the invention. > So if it was not already the case, G

[go-nuts] Going places

2017-07-21 Thread Michael Jones
Maybe not news, and certainly not big news, but I just filed a patent that uses Go source code to illustrate logical methods claimed in the invention. So if it was not already the case, Go has now been used in patent filings. -- Michael T. Jones michael.jo...@gmail.com -- You received this mess

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-21 Thread Sofiane Cherchalli
Hi Rog, Please inline comments. Thx On Thursday, July 20, 2017 at 1:58:09 PM UTC+2, rog wrote: > > I'm not convinced that holding all your values in a uniform way > is going to be that helpful for you. You might be better using reflection > to map the columns into a struct type (there's probabl

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-21 Thread Sofiane Cherchalli
Hi Rog, Please inline comments. Thx On Thursday, July 20, 2017 at 1:58:09 PM UTC+2, rog wrote: > > I'm not convinced that holding all your values in a uniform way > is going to be that helpful for you. You might be better using reflection > to map the columns into a struct type (there's probab

[go-nuts] Re: No Allman-Style, No go!

2017-07-21 Thread thorsteinssonh
I don't get it. It's not even true K&R style. Open brace on function declarations in original K&R books was always on a new line. It is only conditional expressions that have open braces on same line as the conditional. Just check the book, https://github.com/germanoa/compiladores/blob/master

[go-nuts] Re: Sorting user defined collection in multiple ways

2017-07-21 Thread Val
Hello Srinivas The traditional way to achieve this in go (as showcased here and here ) is, to : - declare a named type of slice - implement 3 methods Len, Less, Swap

Re: [go-nuts] Sorting user defined collection in multiple ways

2017-07-21 Thread Jan Mercl
On Fri, Jul 21, 2017 at 3:17 PM wrote: > - I have user defined data structure called Employee with attributes "age", name and sal. I want to write three different go functions that sorts based on age, name and sal. Are you sorting a slice? https://golang.org/pkg/sort/#Slice -- -j -- You rec

[go-nuts] Sorting user defined collection in multiple ways

2017-07-21 Thread srinik . kandula
Hi, I have below requirement, could any one suggest on how i can achieve in go lang using https://golang.org/pkg/sort/. - I have user defined data structure called Employee with attributes "age", name and sal. I want to write three different go functions that sorts based on age, name and sal. e

Re: [go-nuts] "interface{} says nothing", lets consider it destroys information

2017-07-21 Thread mhhcbon
here is a solution to what i described in previous. The result of func mustNotErr(f func() (, error)) func() () {} is the transitivity of t -to> func (...) (..., *-*error) mustNotErr takes in input a func T with any inputs, and a *traling* error, returns in output, the func T *less* the trailing

[go-nuts] Re: go get awkwardness with packages outside of GOPATH

2017-07-21 Thread Simon Ritchie
Just a simple clarification. Your GOPATH variable can contain many directories, as already pointed out. If so, go get will download packages into the FIRST directory in the path. One use of this is to have your own go projects in separate directories with a single shared set of packages loade

Re: [go-nuts] "interface{} says nothing", lets consider it destroys information

2017-07-21 Thread mhhcbon
so wise! thanks for those clarification. I did not deeply understand why it is called an identity func, and why it has to be this signature. It seems so narrowed to a specific case, makes me unhappy. Now, i realized that even if , for some specific cases, seems to solve some situations, it won

[go-nuts] Re: How do you test a server?

2017-07-21 Thread Simon Ritchie
My scaffolding tool generates a web server and some unit and integration tests. The tests use Peter Gotz' mocking framework pegomock. If you generate a server with the scaffolder, you can look at the source code and see how it works. https://github.com/goblimey/scaffolder By the way, not eve