[go-nuts] Multi line go generate vs Bash script

2017-10-16 Thread michal
I have a use case where I use multi line go generate, similar to https://github.com/containous/traefik/blob/master/generate.go //go:generate rm -vf autogen/gen.go //go:generate mkdir -p static //go:generate go-bindata -pkg autogen -o autogen/gen.go ./static/... ./templates/... Would you

[go-nuts] [ANN] sqlx for cassandra gocqlx v1.0.0 released

2018-05-25 Thread michal
GoCQLX is a general purpose extensions to golang's Cassandra driver gocql. With gocqlx you can bind query parameters from maps and structs, use named query parameters (:identifier) and scan query results into structs and slices. It comes with a fluent and flexible CQL query builder and a

[go-nuts] Re: HTTP/2 Adventure in the Go World

2018-08-13 Thread michal
That's cool, I'm not sure if the locks on Conn object [1] are needed, could it just rely on locking in http2? [1] https://github.com/posener/h2conn/blob/master/conn.go#L18 On Sunday, August 12, 2018 at 4:40:03 PM UTC+2, Eyal wrote: > > Hi, > You are welcome to read a blog post I wrote about a

[go-nuts] [ANN]: go_generics code template engine for Go that Google was hiding from you :)

2018-08-10 Thread michal
[3] https://github.com/fatih/set Michal -- 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

[go-nuts] [ANN]: go_generics code template engine for Go that Google was hiding from you :)

2018-08-10 Thread michal
[3] https://github.com/fatih/set Michal -- 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

[go-nuts] Re: [ANN] go-set type-safe sets for Go

2018-08-10 Thread michal
Update: We have made generating sets for your own types really easy now: * go_generate tool was forked and you can just go-get it, see https://github.com/mmatczuk/go_generics * all the generation procedure was wrapped in a bash script In addition to that the original set implementation from

Re: [go-nuts] Re: Generics

2018-12-12 Thread michal
Google has it's own tool that is publicly available as part of gvisor project [1] I think it's as good or better than the provided options. I copied that to enable installation using plain go get (without bazel) [2]. We used that to de-interface github.com/fatih/set so you may see a real usage

[go-nuts] Re: Starlight - run python inside Go to extend your applications - easily

2018-12-11 Thread michal
On Tuesday, December 11, 2018 at 3:35:37 AM UTC+1, Jason E. Aten wrote: > > For full, actual python inside Go, one could combine: > > (a) https://github.com/iodide-project/pyodide has the python scientific > stack compiled to wasm (python + numpy + scipy + numplotlib) > > and > > (b) either

[go-nuts] Re: Starlight - run python inside Go to extend your applications - easily

2018-12-10 Thread michal
On Friday, December 7, 2018 at 9:05:02 PM UTC+1, Nate Finch wrote: > > I’d like to announce starlight - https://github.com/starlight-go/starlight > . > > > Starlight wraps google’s Go implementation of the starlark python dialect > (most notably found in

Re: [go-nuts] Re: Golang should have a center packages index hosting like npm, rust crates

2016-10-27 Thread Michal Bohuslávek
It's not much of a penalisation IMO. It doesn't have to be a large message in red saying: "The author of this package doesn't use semantic versioning. Be careful!". I mean the list of versions can only appear if there are some versions. That way it wouldn't penalise a), although I can't come up

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-06-03 Thread Michal Strba
se 'type'. This would > make converting code so much easier, if this proposal is accepted. > > Just a though. Please tell me whether this would be possible. > > Thanks for your work, it's much appreciated. >Martin > > > On 30.05.19 14:08, Michal Strba wrote: > > Hi

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-06-03 Thread Michal Strba
ot;, which is an important rule. Without qualification, this rule would be hard to express. On Mon, Jun 3, 2019, 15:26 Martin Schnabel wrote: > Hi Michal, > > I would argue that the 'const' keyword would by more correct. Because > the array length is and needs to be constant anyway. And it ha

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-05-31 Thread Michal Strba
@Ian, I have been thinking and I’ve come up with a possible solution to yours and some other problems. I’d love to hear your thoughts on it. Note, that this is a very fresh idea. I’m addressing two problems here: 1. Inability to do Min/Max and other generic numeric functions. 2.

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-05-31 Thread Michal Strba
Btw, as is demonstrated in the proposal, sorting can be solved by passing a comparator to the function: ```go func Sort(a []gen T, less func(T, T) bool) ``` This is actually a far more flexible way than sorting based on an operator or a `Less` method. Sorting based on an operator or `Less`

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-05-30 Thread Michal Strba
Ian and David, thanks for the response! I personally don't consider MIn and Max to be so important, however, I understand if you do. I've added a new little part to the proposal that describes one possible way for them to be supported: Currently, the type-checker has to distinguish between three

[go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-05-30 Thread Michal Strba
Hi Gophers! :) I've been thinking about generics in Go 2 ever since the original contracts proposal and few days ago, ideas finally clicked. One of the main things about this proposal is that it deliberately omits the ability to restrict the set of types a function can work with. This is a

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-06-04 Thread Michal Strba
Again thank you for your work exploring this! > > Best regards >Marin > > On 03.06.19 15:49, Michal Strba wrote: > > 'const' could be fine too. I guess this is mostly a matter of personal > > preference. > > > > Regarding the array length syntax. It does require q

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-06-05 Thread Michal Strba
uot;I haven't had the time yet" is completely understandable. Thanks On Wed, Jun 5, 2019, 22:18 Robert Engels wrote: > > > > > > > -Original Message- > >From: Randall O'Reilly > >Sent: Jun 5, 2019 2:33 PM > >To: Robert Engels > >Cc: Ia

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-06-06 Thread Michal Strba
Taylor napísal(a): > On Wed, Jun 5, 2019 at 3:02 PM Michal Strba wrote: > > > > Ian, have you had the time to evaluate the improvements to my proposal > (the original one in this thread)? I'd love to hear if it has some more > significat shortcomings and know what to

[go-nuts] Re: Go 2 generics counterproposal: giving up restricting types

2019-05-30 Thread Michal Strba
ents that require lots of effort to >> understand. After looking at the link you provided my input, based on >> dealing with cryptic C++ is: Go should not allow cryptic syntax. >> > Generics are useful except when their syntax becomes cryptic > > >>

Re: [go-nuts] Re: Go 2 generics counterproposal: giving up restricting types

2019-05-30 Thread Michal Strba
on my history dealing with > unnecessary and avoidable 'cryptic C++, > my input is: Generics are a great idea EXCEPT when they allow use of > cryptic syntax > > On Thursday, May 30, 2019 at 12:29:03 PM UTC-4, Michal Strba wrote: >> >> Hi Gophers! :) >> &g

Re: [go-nuts] bogus "missing return at end of function"

2019-06-09 Thread Michal Strba
Can you post a code (preferably a link to play.golang.org) that does this? I can't reproduce it myself. On Mon, Jun 10, 2019, 02:40 Marvin Renich wrote: > Is it already a known issue that a «for [true] { ... }» loop whose only > exit path is through return statements inside the loop (i.e. no

[go-nuts] A proof-of-concept implementation of my generics proposal for Go

2019-06-27 Thread Michal Strba
of Go. The implementation is a program that takes a Go file that uses generics and translates it to a regular Go file that you can run. Try it out here :) <https://github.com/faiface/generics> I'm looking forwad to all your feedback! Michal Štrba -- You received this message because you ar

Re: [go-nuts] Re: errors/wrap.go looks like it could be made into a more general monad package?

2019-07-02 Thread Michal Strba
First of all, this is not at all what "monad" means. A monad is a way to express threading of values between computations. A result of one computation gets threaded as an input to the next one, and so on. Second, what would be the use-case of this other than errors? On Wed, Jul 3, 2019, 04:52

Re: [go-nuts] Re: A proof-of-concept implementation of my generics proposal for Go

2019-06-30 Thread Michal Strba
oposal, but using the > "type" keyword seems very natural. And I like the 80/20 constraints thing > with eq/ord/num. Good work -- I hope this gets turned into an official > proposal and debated. > > > > -Ben > > > > > > On Thursday, June 27, 2019 at 10:2

Re: [go-nuts] VSCode

2019-08-27 Thread Michal Strba
Why do you need to modify the .bashrc file? All I did was to install the Go extension and everything else proceeded either automatically or through a few dialog boxes. On Tue, 27 Aug 2019 at 14:40 Andreqx wrote: > I am trying to install VSCode to run with Go. I Need to modify the > /.bashrc

Re: [go-nuts] A better io.Reader.Read signature?

2019-09-05 Thread Michal Strba
Your proposed signature has a little problem and that is that when calling result, err := reader.Read(nil) the Read method doesn’t know how many bytes it should read. The incoming buffer parameter actually serves two purposes. First is to provide a place for storage. The second is to tell

Re: [go-nuts] Re: About the Google logo on the new Go website

2019-07-16 Thread Michal Strba
Okay, so just to explain why I started this topic and what exactly we are talking about. First of all, just to clear up any doubts, I have no problem with the logo. Google 100% deserves to be there. The thing that I'm talking about is this. Every once in a white, I come across a discussion that

[go-nuts] About the Google logo on the new Go website

2019-07-15 Thread Michal Strba
As you all know, the new, redesigned Go website has a Google logo in the bottom right corner. Someone opened an issue about this, worrying that with the logo, nobody will see Go as a community project: https://github.com/golang/go/issues/33021 The issue was promptly closed and locked by a Go

Re: [go-nuts] Re: About the Google logo on the new Go website

2019-07-17 Thread Michal Strba
Guys, why not keep the discussion to the point. Oracle is quite irrelevant here. The issue is the perception of Go among programmers. On Wed, Jul 17, 2019, 11:46 Wojciech S. Czarnecki wrote: > On Tue, 16 Jul 2019 23:06:41 -0700 > Michael Jones wrote: > > > In regards to Oracle, I was delighted

Re: [go-nuts] is there any type that cannot be sent on a channel?

2019-06-30 Thread Michal Strba
Not sure where you read that. Anything can be sent on a channel. Even channels can be sent over channels. That's often used when one goroutine needs to reply to a message from another goroutine. ne 30. 6. 2019 o 18:31 Sathish VJ napísal(a): > I thought I read somewhere that functions cannot be

Re: [go-nuts] Generics and parentheses

2020-07-21 Thread Michal Strba
I'd say a dot is necessary when instantiating a function call but unnecessary when instantiating a type because it's always syntactically clear when a type is required. ut 21. 7. 2020 o 18:51 napísal(a): > Using angle brackets is not a must for supporting generics, but it is the > common syntax

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

2020-07-21 Thread Michal Strba
Thanks for the feedback Ian! I was drawing the idea mostly from Rust, which already does the same thing, but uses "::" instead of a dot and it works fine there, but sure, it has its drawbacks. st 22. 7. 2020 o 0:05 Ian Lance Taylor napísal(a): > On Tue, Jul 21, 2020 at 8:49 AM wrote: > > > > I

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

2020-07-15 Thread Michal Strba
Angle brackets are only problematic in expressions in the bodies of functions when specializing a function or a type, right? They are not problematic in signatures and type definitions. What about using a dot when specializing in bodies? func zero() T { var z T return z }

Re: [go-nuts] Generics and parentheses

2020-07-22 Thread Michal Strba
Very correct! At least from my perspective. On Thu, 23 Jul 2020 at 02:02 Russ Cox wrote: > So it sounds like everyone is in favor of the entire generics proposal and > all the semantics, and all we have left to hammer out is the bracket > characters? Do I have that right? > > Best, > Russ > > >

[go-nuts] Thoughts on the try proposal (and Generics)

2020-07-28 Thread Michal Bohuslávek
I've been thinking a lot about this Russ's comment from the try proposal: > But before we get to try, it is worth making sure we're all on the > same page about appropriate error context. The canonical example > is os.Open.

[go-nuts] Ambiguous Method Promotion Bug?

2020-11-17 Thread Michal Ostrowski
Here is a playground doc that demonstrates what seems to be strange behavior regarding promotion of methods. https://play.golang.org/p/R9M1lAOd9CA It seems that I can generate a struct a have an ambiguous method by adding a level of indirection in struct definitions. Or there's something in

[go-nuts] Data race in sql package

2022-07-21 Thread Michal Hruby
Hello, I have a code snippet equivalent to this one: rows, err := stmt.QueryContext(ctx) if err != nil { return info, nil, err } defer rows.Close() var data sql.RawBytes for rows.Next() { err = rows.Scan() if err != nil { return nil, err } // if ctx is canceled around

Re: [go-nuts] Data race in sql package

2022-07-22 Thread Michal Hruby
I'm guessing that Michal is flagging is there no way to write safe code if > your using stmt.QueryContext(ctx) and rows.Scan into a sql.RawBytes > as QueryContext kicks off a go routine that monitors the ctx, closing rows > if cancelled and that ctx can be cancelled at any time. > &