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

2018-10-22 Thread Robert Engels
Wait... you can ship a Go binary that dynamically links with the Go runtime and stdlib at runtime??? Awesome. Can you point me to the docs on this. I’ve always considered the “single binary” taunted feature as somewhat of a limitation because of this. > On Oct 22, 2018, at 9:41 PM, Ian Lance

Re: [go-nuts] Regarding contracts

2018-10-22 Thread Marvin Renich
> Ian Denhardt : > > But I think fundamentally folks have to > > make choice: do we want to be able to write `<` for user defined types, or > > do > > we want to be able to look at the `<` operator and know for certain that > > it's > > not calling a method? You can't have both. You can have

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

2018-10-22 Thread Ian Lance Taylor
On Mon, Oct 22, 2018 at 7:18 PM, robert engels wrote: > > I think there is a bigger concern than shipping binaries. I believe that the > Go stdlib and runtime should be shipped as a shared library, and be field > upgradable independent of the binaries. This is the only reasonable way to > to

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

2018-10-22 Thread robert engels
I think there is a bigger concern than shipping binaries. I believe that the Go stdlib and runtime should be shipped as a shared library, and be field upgradable independent of the binaries. This is the only reasonable way to to distribute security patches in an efficient and stable manner.

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

2018-10-22 Thread Fino
I think Binary-only packages are very important for Go's Eco, something like maven(Java) & sbt(scala) - all it's dep packages should save in the same repo, together, like a snapshot, or similar concept like docker image - use a manifest file to list all the dep package's name and version

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

2018-10-22 Thread alan . fox6
Hi Patrick, I guess it's largely a matter of taste but one of the reasons why I prefer contracts to interfaces is precisely because you only need one contract for the type parameters as a whole. This keeps the type parameter section of the generic function/type relatively brief when you have

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread 'Axel Wagner' via golang-nuts
On Mon, Oct 22, 2018 at 10:41 PM Eric S. Raymond wrote: > Axel Wagner : > > But personally I don't see the point of introducing a custom iterator > concept > > just to *occasionally* save one or two lines of code. > > Don't despise saving lines of code. There's a well-known law the name of >

Re: [go-nuts] Q16.16 fixed point numbers in go

2018-10-22 Thread Vasiliy Tolstov
Thanks for suggestions. If somebody can look at github.com/unistack-org/go-crush package (ported ceph crush to go) i'l be happy. Now weight represented as float32, i'm try to use https://github.com/shopspring/decimal but code looks ugly with many conversations. And also as i see ceph code

Re: [go-nuts] While implement ssh client using golang, record keyboard input

2018-10-22 Thread Michael Jones
Seems natural to have an architecture where one loop reads the input and passes complete lines to a consumer. This reading loop would store lines in a list (array, buffer,...) and thus be able to resubmit them to the consumer. On Mon, Oct 22, 2018 at 1:57 PM Sun Frank wrote: > Hi Everyone: > >

[go-nuts] While implement ssh client using golang, record keyboard input

2018-10-22 Thread Sun Frank
Hi Everyone: I came across a problem which puzzled me for couple of days. I am trying to write a* SSH client with a Interactive Shell *using golang, but i also need to record the command(or keystroke history) of the user typed, like the history feature, here's my working code: ce := func(err

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread Ian Denhardt
Quoting robert engels (2018-10-22 16:01:18) > I am sure it has been discussed, but why the aversion to using < > in > type declarations? I guess I just don’t understand using bracketing > notations that are already used for something else. This was mentioned in the draft design, but using `<` at

[go-nuts] Can vet report useless assignments in method?

2018-10-22 Thread 'Carl Mastrangelo' via golang-nuts
Hi go nuts, https://play.golang.org/p/ylYlbVMQ24- I recently hit an error where I had been calling methods on a struct. Originally, the fields in the struct were never changed, but after some iterations, i added some state to my struct. The methods which modified the state were always

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread Eric S. Raymond
Axel Wagner : > But personally I don't see the point of introducing a custom iterator concept > just to *occasionally* save one or two lines of code. Don't despise saving lines of code. There's a well-known law the name of which I've forgotten that defect rates per KLOC are rougly constant

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread Eric S. Raymond
Tamás Gulácsi : > You can achive sth like this with a function returning a chan. I'm aware of this. There's a good essay on iterator patterns https://ewencp.org/blog/golang-iterators/index.html that goes into three of the possibilties in detail. It covers the problem with the channel idiom,

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

2018-10-22 Thread Patrick Smith
On Fri, Oct 19, 2018 at 10:48 AM alanfo wrote: > In the light of all the feedback there's been, I've put together a > proposal which sticks closely to the original design and only changes what > most people consider needs to be changed in some way. Some recent ideas > which seemed plausible but

[go-nuts] Failed iterator proposals?

2018-10-22 Thread Tamás Gulácsi
You can achive sth like this with a function returning a chan. Or create a filtering function and apply it, creating a second slice. Neither is perfect - the first is closer to the python generator, the secobd is to the declared use case. -- You received this message because you are

Re: [go-nuts] Regarding contracts

2018-10-22 Thread Burak Serdar
On Mon, Oct 22, 2018 at 1:53 PM Marvin Renich wrote: > > * Burak Serdar [181018 15:08]: > > tbh, I am not trying to avoid operator overloading, I am trying to > > avoid the contracts. With operator overloading, you can write: > > > > func F(a,b type T like(int,X)) { > >if a > ... > >

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread robert engels
I am sure it has been discussed, but why the aversion to using < > in type declarations? I guess I just don’t understand using bracketing notations that are already used for something else. When I see [] I can immediately see - ah, slice/map reference. When I see () I can immediately see - ah

Re: [go-nuts] Regarding contracts

2018-10-22 Thread Marvin Renich
* Burak Serdar [181018 15:08]: > tbh, I am not trying to avoid operator overloading, I am trying to > avoid the contracts. With operator overloading, you can write: > > func F(a,b type T like(int,X)) { >if a ... >} > } > > provided X is a type that supports <. Are you trying to

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread 'Axel Wagner' via golang-nuts
There's also the additional objection that this doesn't play well with break/return - if the iterator needs to do some cleanup (say, closing a file or something). IMO, these days, just use bufio.Scanner-like iterators or just a channel+context, if syntax is that important to you. But personally I

Re: [go-nuts] Re: A suggestion for the error handling proposal

2018-10-22 Thread Burak Serdar
On Mon, Oct 22, 2018 at 12:31 PM Liam wrote: > > You might want to read the links on the feedback wiki, if you haven't already: > https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback > > Quite a lot of them suggest named handlers. One difference in this proposal is that handler err { }

[go-nuts] Re: A suggestion for the error handling proposal

2018-10-22 Thread Liam
You might want to read the links on the feedback wiki, if you haven't already: https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback Quite a lot of them suggest named handlers. Feel free to add your gist link to the wiki! On Monday, October 22, 2018 at 7:33:38 AM UTC-7, Burak Serdar

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread Eric S. Raymond
David Anderson : > https://github.com/golang/go/issues/13027 is a past proposal to allow the > `range` operation to work on arbitrary types (although it was originally > proposed as a narrow enhancement on container/list only). Didn't get very > far, but sprinkled in the bug are some of the

Re: [go-nuts] Why doesn't this benchmark test end?

2018-10-22 Thread Sathish VJ
Thank you Ian. On Monday, 22 October 2018 21:46:44 UTC+5:30, Ian Davis wrote: > > > > > On Mon, 22 Oct 2018, at 4:36 PM, Sathish VJ wrote: > > So, I also tried with > *go test -v -bench=. -test.benchtime=0.1s * > and that does complete. > > But is the implication that StopTimer/StartTimer is

Re: [go-nuts] Why doesn't this benchmark test end?

2018-10-22 Thread Ian Davis
On Mon, 22 Oct 2018, at 4:36 PM, Sathish VJ wrote: > So, I also tried with > *go test -v -bench=. -test.benchtime=0.1s * > and that does complete. > > But is the implication that StopTimer/StartTimer is too costly to use > even for this simple benchmark? See

Re: [go-nuts] Why doesn't this benchmark test end?

2018-10-22 Thread robert engels
No, think about it... If the setup time is 1 minute per iteration, and the timed activity is 1 usec per iteration, then in order to time for 1 second the test would need to run for a million minutes…. You need to restructure the test to avoid the setup on every test invocation. > On Oct 22,

Re: [go-nuts] Why doesn't this benchmark test end?

2018-10-22 Thread Sathish VJ
So, I also tried with *go test -v -bench=. -test.benchtime=0.1s * and that does complete. But is the implication that StopTimer/StartTimer is too costly to use even for this simple benchmark? On Monday, 22 October 2018 21:00:20 UTC+5:30, Jan Mercl wrote: > > > > > On Mon, Oct 22, 2018 at

Re: [go-nuts] Why doesn't this benchmark test end?

2018-10-22 Thread Jan Mercl
On Mon, Oct 22, 2018 at 5:21 PM Sathish VJ wrote: I believe it does actually end, it's just the timeout kicks in sooner. The testing package attempts to make the benchmark run for at least 1 sec by default, IINM. Your code has two parts. The measured one is like 1 nsec. The non-measured is tens

[go-nuts] Why doesn't this benchmark test end?

2018-10-22 Thread Sathish VJ
Play Link: https://play.golang.org/p/YppC11kwyLz Running this command hangs the program: go test -v -bench=. *"*** Test killed with quit: ran too long (10m0s)."* But if I comment out the stop/start timer, it is fine. I tried both with go1.10 and go1.11. Same result. I have no other file in

Re: [go-nuts] Re: A suggestion for the error handling proposal

2018-10-22 Thread Burak Serdar
It is public, but github is behaving weirdly since this morning. I include it here: This is a suggestion to make error handling more explicit than what's described in the official proposal. An error handler is declared as: handle err { return err } This declares err as an error variable, and

[go-nuts] Re: A suggestion for the error handling proposal

2018-10-22 Thread Jon Conradt
I got a 404 when I tried to access this. Perhaps it is not public? Jon On Monday, October 22, 2018 at 10:33:38 AM UTC-4, Burak Serdar wrote: > > I read the error handling proposal recently, and although I like it in > general, I don't like the fact that it hides the actual error > variables

[go-nuts] [ANN] go-resty v1.10.0 released - Simple HTTP and REST client library

2018-10-22 Thread Jeevanandam M.
Production Version : gopkg.in/resty.v1 godoc : https://godoc.org/gopkg.in/resty.v1 Changelog: Enhancement * Debug log callback added to customize log info before logging it #180 #182 PR #186 @jeevatkm * Updated every reference to point to `gopkg.in/resty.v1` inline with go mod

[go-nuts] A suggestion for the error handling proposal

2018-10-22 Thread Burak Serdar
I read the error handling proposal recently, and although I like it in general, I don't like the fact that it hides the actual error variables from the flow. Also, I think the error chaining method as described in the proposal is not very useful. So I came up with this suggestion:

[go-nuts] Q16.16 fixed point numbers in go

2018-10-22 Thread 'Ingo Oeser' via golang-nuts
https://godoc.org/golang.org/x/image/math/fixed might provide some hints how to work with this kind of type. The idea is to use a special type and provide all operations you need. https://godoc.org/math/big#Rat might be helpful to create first tests of the basic math operations with maximum

[go-nuts] Re: Strange problem with sql and mattn/go-sqlite3 driver

2018-10-22 Thread EricR
Sorry, the uncommented "todo not working" was left in by me so it wouldn't compile. It won't work when I fix that either, of course. func getListField(db *sql.DB, table string, item string, field string) ( > string, error) { > tableName := listFieldToTableName(table, field) > if

[go-nuts] Strange problem with sql and mattn/go-sqlite3 driver

2018-10-22 Thread EricR
Hi! It seems that the driver sometimes does not return an error if a column is null and I scan for s string, but instead returns the column name. I have to explicitly use the following function to test for null. func FieldIsNull(db *sql.DB, table string, item string, field string) bool {

Re: [go-nuts] Q16.16 fixed point numbers in go

2018-10-22 Thread Vasiliy Tolstov
Does it possible to avoid conversation and works only with fixed point (if this can bring performance speedup)? пн, 22 окт. 2018 г. в 16:13, Vasiliy Tolstov : > > пн, 22 окт. 2018 г. в 16:02, Jan Mercl <0xj...@gmail.com>: > > > > On Mon, Oct 22, 2018 at 2:35 PM Vasiliy Tolstov wrote: > > > > >

Re: [go-nuts] Q16.16 fixed point numbers in go

2018-10-22 Thread Vasiliy Tolstov
пн, 22 окт. 2018 г. в 16:02, Jan Mercl <0xj...@gmail.com>: > > On Mon, Oct 22, 2018 at 2:35 PM Vasiliy Tolstov wrote: > > > Does reading this 4 bytes to uint32 and use math.Float32frombits looks > > right? > > It does not look right, see >

Re: [go-nuts] Q16.16 fixed point numbers in go

2018-10-22 Thread Jan Mercl
On Mon, Oct 22, 2018 at 2:35 PM Vasiliy Tolstov wrote: > Does reading this 4 bytes to uint32 and use math.Float32frombits looks right? It does not look right, see https://en.wikipedia.org/wiki/Q_(number_format)#Q_to_float -- -j -- You received this message because you are subscribed to the

[go-nuts] Q16.16 fixed point numbers in go

2018-10-22 Thread Vasiliy Tolstov
Hi! I have some binary format that contains in 4 bytes Q16.16 fixed point number in LittleEndian. Does reading this 4 bytes to uint32 and use math.Float32frombits looks right? And also as i understand if in my code i use float32 i have performance decrease vs if i work with fixed point int? --

Re: [go-nuts] Failed iterator proposals?

2018-10-22 Thread Eric Raymond
Thank you, that was a helpful response. -- 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

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

2018-10-22 Thread Scott Cotton
On Monday, 22 October 2018 07:17:57 UTC+2, Ian Lance Taylor wrote: > > 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 > >

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

2018-10-22 Thread Scott Cotton
Yes Robert's observation that you need all values to merge sorted data, and that channels don't provide this. However, if the implementation receives on channels ahead of time, then this isn't a problem because you do have one value from each source to decide how to proceed. On Sunday, 21

Re: [go-nuts] How would Go 2 code using generics actually look like?

2018-10-22 Thread Sebastien Binet
Hi Volker, On Mon, Oct 22, 2018 at 10:57 AM Volker Dobler wrote: > The Go 2 draft generics draft has been discussed a lot, > especially contracts have drawn a lot of attention and > other ways to limit the set of possible type were suggested. > > Most discussions orbited around very basic

[go-nuts] How would Go 2 code using generics actually look like?

2018-10-22 Thread Volker Dobler
The Go 2 draft generics draft has been discussed a lot, especially contracts have drawn a lot of attention and other ways to limit the set of possible type were suggested. Most discussions orbited around very basic polymorphic functions like polymorphic Min or a Map functions. I do consider a

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

2018-10-22 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