[go-nuts] [ANN] ethereum-playbook: configure and deploy Ethereum DApp infrastructures using a static specification

2018-10-21 Thread Maxim Kupriianov
Ethereum-playbook is a CLI tool that configures and deploys Ethereum DApp infrastructures using a static specification. Ethereum is a decentralized platform that runs "persistent scripts" called smart contracts. These sentinels resemble the usual microservices in a web application architecture,

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-21 Thread Ian Lance Taylor
On Sat, Oct 20, 2018 at 1:26 PM, jclc via golang-nuts wrote: > > Currently I don't use them, but couldn't binary packages be used to > distribute CGO-dependent packages for developers who might not have a C > cross-compiler? I think the feature would be more commonly used if it wasn't > so impract

Re: [go-nuts] different way to malloc memory when creating channel

2018-10-21 Thread Fei Ding
Thanks for the clarification. On Mon, Oct 22, 2018 at 13:13 Ian Lance Taylor wrote: > On Sun, Oct 21, 2018 at 8:34 PM, Fei Ding wrote: > > > > I am studying golang source code, literally `go/src/runtime/chan.go`, the > > question is in function `makechan`, when it comes to malloc memory for > >

Re: [go-nuts] different way to malloc memory when creating channel

2018-10-21 Thread Ian Lance Taylor
On Sun, Oct 21, 2018 at 8:34 PM, Fei Ding wrote: > > I am studying golang source code, literally `go/src/runtime/chan.go`, the > question is in function `makechan`, when it comes to malloc memory for > channel with/without pointers, you guys did it as: > > > case elem.kind&kindNoPointers != 0: >

Re: [go-nuts] NaN as map key?

2018-10-21 Thread Jan Mercl
On Mon, Oct 22, 2018 at 6:50 AM Aston Motes wrote: > Even though you can get at the values by iterating, I can't seem to do so with a direct reference to the NaN key: https://play.golang.org/p/69m-LK7obHA Yes. Map indexing returns the value for the key that compares equal, so WAI. -- -j --

Re: [go-nuts] NaN as map key?

2018-10-21 Thread Aston Motes
Even though you can get at the values by iterating, I can't seem to do so with a direct reference to the NaN key: https://play.golang.org/p/69m-LK7obHA On Sun, Oct 21, 2018 at 4:18 PM Burak Serdar wrote: > On Sun, Oct 21, 2018 at 4:59 PM Dan Kortschak > wrote: > > > > They are not inaccessible,

Re: [go-nuts] Calendar Integration Values

2018-10-21 Thread Caleb Mingle
John, Can you provide more details on which "calendar library" you are referring to? The link you've highlighted in Google calendar points to a file in iCalendar format. You'll probably want an iCalendar parser to handle the file, I've personally used this one, but it doesn't handle everything in

Re: [go-nuts] NaN as map key?

2018-10-21 Thread Jan Mercl
On Mon, Oct 22, 2018 at 12:33 AM Burak Serdar wrote: Related reading: https://research.swtch.com/randhash -- -j -- 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

[go-nuts] different way to malloc memory when creating channel

2018-10-21 Thread Fei Ding
Hi I am studying golang source code, literally `go/src/runtime/chan.go`, the question is in function `makechan`, when it comes to malloc memory for channel with/without pointers, you guys did it as: case elem.kind&kindNoPointers != 0: // Elements do not contain pointers. // Allocate hchan and

Re: [go-nuts] NaN as map key?

2018-10-21 Thread Dan Kortschak
Map access involves finding the correct bucket and then checking for key equality. NaN is never equal to anything, so the equality check fails and item is not there. On Sun, 2018-10-21 at 19:11 -0700, Aston Motes wrote: > Even though you can get at the values by iterating, I can't seem to > do so

Re: [go-nuts] Failed iterator proposals?

2018-10-21 Thread David Anderson
The pattern you describe is used in several stdlib packages (notably bufio.Scanner, which leads to a loop that looks like `for scanner.Scan() { doStuff(scanner.Text()) }`. The only variation from your example is that in the stdlib, `iterator.Continue()` both tests for the end condition and advances

[go-nuts] Failed iterator proposals?

2018-10-21 Thread Eric Raymond
I have a real-world case where I need Python style iterators for performance. It's not good to eager-evaluate an event-list 259K items when you know that in the typical case you're only going to select two or three orders of magnitude fewer of them to be passed to a work function. (The list

Re: [go-nuts] Variadic functions using ...interface{}

2018-10-21 Thread Ian Davis
On Sun, 21 Oct 2018, at 10:52 PM, Justin Israel wrote: > I was getting an error trying to pass a []string to this elasticsearch > API ctor:> > https://github.com/olivere/elastic/blob/v6.2.11/search_queries_terms_set.go#L26> > > func NewTermsSetQuery(name string, values ...interface{}) > *TermsSe

Re: [go-nuts] NaN as map key?

2018-10-21 Thread Burak Serdar
On Sun, Oct 21, 2018 at 4:59 PM Dan Kortschak wrote: > > They are not inaccessible, they are just inaccessible via reflect (at > the moment). > > https://play.golang.org/p/_EnLPRvrHAz > > fmt uses reflect to get the keys and values. With the addition of a map > iterator type in reflect (https://ti

Re: [go-nuts] NaN as map key?

2018-10-21 Thread Dan Kortschak
They are not inaccessible, they are just inaccessible via reflect (at the moment). https://play.golang.org/p/_EnLPRvrHAz fmt uses reflect to get the keys and values. With the addition of a map iterator type in reflect (https://tip.golang.org/pkg/reflect/#MapIter), the behaviour you see now will c

[go-nuts] NaN as map key?

2018-10-21 Thread Burak Serdar
Someone asked a question a few days ago related to this, and it's been bugging me since then. Is this an undefined behavior according to the spec? https://play.golang.org/p/RqgD492EZ9U The code results in a map with two NaN keys, both of which have nil values. I think having two NaN keys is reas

Re: [go-nuts] Python heapq.merge in golang using channels?

2018-10-21 Thread robert engels
I don’t think that is correct. If the channels provide sorted async data - you need to have a value available at every channel in order to produce a sorted merged. The consumer needs to wait until every channel has supplied a value. Otherwise - imagine 2 channels A,B. A provides 5, B has not pr

[go-nuts] Variadic functions using ...interface{}

2018-10-21 Thread Justin Israel
I was getting an error trying to pass a []string to this elasticsearch API ctor: https://github.com/olivere/elastic/blob/v6.2.11/search_queries_terms_set.go#L26 func NewTermsSetQuery(name string, values ...interface{}) *TermsSetQuery And it was failing with "cannot use vals (type []string) as typ

Re: [go-nuts] Using reflect to utilized the call to gob.Register()?

2018-10-21 Thread Sebastien Binet
On Sun, Oct 21, 2018 at 9:53 PM Trig wrote: > Is it possible, somehow, to use reflection to utilize the call to > gob.Register()? Something like: > > gob.Register(m.Type().In(0)) > > this should do: gob.Register(reflect.New(m.Type().In(0)).Elem().Interface()) hth, -s -- You received this mes

[go-nuts] Re: Proposed changes to the Go draft generics design in the light of feedback received

2018-10-21 Thread alanfo
There were a number of other aspects raised in the draft design such as whether it should automatically be assumed that a generic map key was comparable and whether there should be a special syntax for the zero value of a type parameter. I've added a short Appendix to the paper with my thoughts

[go-nuts] Using reflect to utilized the call to gob.Register()?

2018-10-21 Thread Trig
Is it possible, somehow, to use reflection to utilize the call to gob.Register()? Something like: gob.Register(m.Type().In(0)) Problem I'm having is that m.Type().In(0) is a type of *reflect.rtype, so it registers that... and not the actual type being reflected. -- You received this message

Re: [go-nuts] Python heapq.merge in golang using channels?

2018-10-21 Thread roger peppe
Channels can work fine for this kind of thing. The easiest (but probably a little less efficient) way is to write a function that knows how to merge two channels, then use n-1 of them to merge n channels. Whenever you don't currently have a value from a channel, read one, then output the smallest

Re: [go-nuts] Re: go src organization question

2018-10-21 Thread Sankar P
I am yet to go through your mail in detail. But I will answer the primary question first. I have a monolithic repository which contains all my go backend related code in a single project. I have about 8 packages that are internally defined inside my repo, and I do not need any version management fo

Re: [go-nuts] go src organization question

2018-10-21 Thread Sam Whited
On Sun, Oct 21, 2018, at 11:31, Sankar wrote: > For such a hybrid requirement, what is the most recommended way to import > and structure our libraries and the source directories, to work with go > modules? A single module at the root of the project should give you what you want. Create the fil

[go-nuts] Re: go src organization question

2018-10-21 Thread thepudds1460
Hi Sankar, How many repos are you directly modifying? Most projects are likely following the simplest approach of using a single module per repository, which typically would mean creating one go.mod file located in the root directory of each repository. (The official modules proposal predicts

[go-nuts] go src organization question

2018-10-21 Thread Sankar
Hi, We were using go 1.7 until recently and now want to switch to 1.11 and start using go modules. Currently our source organization is as follows: ~/go/src/gitlab.com/example/ | | example/

Re: [go-nuts] relaxing type conversions: an "almost possible" idea with Go generics

2018-10-21 Thread 'Axel Wagner' via golang-nuts
Last addition: On Sun, Oct 21, 2018 at 2:03 PM roger peppe wrote: > Ah, I *think* I see where you might be coming from now. You're thinking > that the compiler could do some kind of Go-to-Go transformation for generic > functions so that they looked exactly as if they'd been written using > inte

Re: [go-nuts] relaxing type conversions: an "almost possible" idea with Go generics

2018-10-21 Thread 'Axel Wagner' via golang-nuts
On Sun, Oct 21, 2018 at 2:03 PM roger peppe wrote: > Yes. The draft proposal says "generic functions, rather than generic > types, can probably be compiled using an interface-based approach. That > will optimize compile time, in that the package is only compiled once, but > there will be some run

[go-nuts] Calendar Integration Values

2018-10-21 Thread John More
I can not find any documentation indicating how to retrieve the Calendar Integration Values below. I can create and manipulate calendars add events etc using the calendar library. Is it possible that these values are simply not available? Thanks any assistance is appreciated. John More [image:

Re: [go-nuts] relaxing type conversions: an "almost possible" idea with Go generics

2018-10-21 Thread roger peppe
On Sat, 20 Oct 2018 at 11:37, Axel Wagner wrote: > > Thank, I feel I can work with this :) > > On Sat, Oct 20, 2018 at 10:58 AM roger peppe wrote: > >> That transformation might be valid for the simple case you have there, >> where there's a single parameter of exactly the interface type, but ge

Re: [go-nuts] Proposed changes to the Go draft generics design in the light of feedback received

2018-10-21 Thread alan . fox6
I've thought of some other ways of excluding 'string' so that one could restrict an 'exclude' constraint to just numeric types. At the expense of adding another line, you could do: int(T) or if (say) T * T implied T + T, T - T and T / T (which would certainly be true) then you could use that