Re: [go-nuts] Re: is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Marwan abdel moneim
yes, you are right, if i am going to drop http.JSON and http.Response i am trying to do that, i think it is better to make it small like you have said thanks On Saturday, January 28, 2017 at 5:50:08 AM UTC+2, Matt Silverlock wrote: > > This definitely doesn't require you to modify net/http direc

Re: [go-nuts] Re: is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Matt S
This definitely doesn't require you to modify net/http directly. Just create a library with custom handler types that satisfy the http.Handler interface. Many existing Go routing libraries & frameworks will get you 90% of the way there. On Fri, Jan 27, 2017 at 7:42 PM Marwan abdel moneim wrote:

Re: [go-nuts] Re: is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Matt S
This definitely doesn't require you to modify net/http directly. Just create a library with custom handler types that satisfy the http.Handler interface. Many existing Go routing libraries & frameworks will get you 90% of the way there. On Fri, Jan 27, 2017 at 7:42 PM Marwan abdel moneim wrote:

Re: [go-nuts] Re: is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Marwan abdel moneim
i want to do something like this http.Handler{ Action: "Create new user", Method: "POST", URI: "/users", Auth: false, Params: []string{"name:max=100"}, Do: func(r *http.Request) http.Response{ .. return http.JSON(&user) }} and do the common tasks lik

Re: [go-nuts] Re: is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Matt S
Which functions? What are you actually changing? A wrapper library doesn't have to wrap all the functions: just wrap the ones you need to and make it a small, composable library. On Fri, Jan 27, 2017 at 7:12 PM Marwan abdel moneim wrote: > do your changes require you to modify the package? >

[go-nuts] Re: is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Marwan abdel moneim
> > do your changes require you to modify the package? > yes, i want to add some functions, but still provide all the package to the user Why not use wrap it? > i would have to wrap all the functions, very tedious On Saturday, January 28, 2017 at 5:06:31 AM UTC+2, Matt Silverlock wrote: > > N

[go-nuts] is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Matt Silverlock
No, but without more context, do your changes require you to modify the package? Why not use wrap it? -- 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

[go-nuts] Call for Feedback: Scoping gorilla/sessions v2

2017-01-27 Thread Matt Silverlock
gorilla/sessions has been around for a while, and with request.Context() back in Go 1.7, there's an unavoidable need to make breaking changes to the library. While we're at it, breaking a bunch more (and simplifying others!) in the process makes a whole lot of sense. We've also been ultra-carefu

Re: [go-nuts] Short vs. long variable declarations

2017-01-27 Thread Will Faught
Variable shadowing is rarely, if ever, a problem for me too; but what about for newcomers? I think my copy/paste point stands, though; everyone has those problems, at least occasionally. On Fri, Jan 27, 2017 at 3:00 PM Tyler Compton wrote: > While theoretically, I agree with your argument again

Re: [go-nuts] Short vs. long variable declarations

2017-01-27 Thread Will Faught
This seems to be a discussion about short variable names. What's the connection? On Fri, Jan 27, 2017 at 10:58 AM Shawn Milochik wrote: > Here's a good discussion about it: > > https://groups.google.com/d/msg/golang-nuts/J9QeizedpuI/ECifbR0YGcsJ > > TL;DR: scope > > -- > You received this messag

Re: [go-nuts] Short vs. long variable declarations

2017-01-27 Thread Shawn Milochik
On Fri, Jan 27, 2017 at 6:00 PM, Tyler Compton wrote: > While theoretically, I agree with your argument against using the short > variable declaration pattern, I've personally found that in practice it > isn't an issue. I think that if this is something you run into often, it > might suggest that

Re: [go-nuts] Short vs. long variable declarations

2017-01-27 Thread Tyler Compton
While theoretically, I agree with your argument against using the short variable declaration pattern, I've personally found that in practice it isn't an issue. I think that if this is something you run into often, it might suggest that you're letting too many variables into your scope, whether that

[go-nuts] Re: Go 1.8rc3 - surprise

2017-01-27 Thread joetsai via golang-nuts
When I was deploying Go1.8 in my company, I found url.Parse to also caused many problems. However, every time I looked closely at the failure, I was convinced that it was because of a mis-use of the url package, rather than Go1.8's fault. If anything, I think the documentation for the url packag

[go-nuts] is there a way to mirror a standard package while adding some functions to it?

2017-01-27 Thread Marwan abdel moneim
i want to add few changes for the net/http package, while keeping the rest of the package as it is, but without copying the package source and put it in another one, i want my package to mirror whatever the package version installed -- You received this message because you are subscribed to th

[go-nuts] Go 1.8rc3 - surprise

2017-01-27 Thread Matt Aimonetti
Just a quick heads up since we noticed an issue testing 1.8rc3 against our code. The issue is quite subtle and was hidden inside a dependency package of ours: https://github.com/pubnub/go/tree/master/messaging After updating our containers to 1.8 we started noticing that pubnub was rejecting th

Re: [go-nuts] Go 1.7.5 and Go 1.8rc3 are released

2017-01-27 Thread Steven Hartland
Nice thanks for sharing that :) On 27/01/2017 16:42, alb.donize...@gmail.com wrote: A better link is this one, IMHO: github.com/golang/go/compare/go1.7.4...go1.7.5 the gerrit one shows uninteresting CLs too, like: [release-branch.go1.7] cmd/godoc: add perf subrepo while the github one doesn'

Re: [go-nuts] Short vs. long variable declarations

2017-01-27 Thread Shawn Milochik
Here's a good discussion about it: https://groups.google.com/d/msg/golang-nuts/J9QeizedpuI/ECifbR0YGcsJ TL;DR: scope -- 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] Short vs. long variable declarations

2017-01-27 Thread Will Faught
Which do you default to? I see a lot of code using short decls in most cases, and only using long decls with no initialization where the zero value is needed. It seems to me that long decls should be the default declaration used because short decls are context-sensitive. That is, you have no

Re: [go-nuts] testing.Benchmark Unanswered StackOverflow question. Looks like a bug.

2017-01-27 Thread Ilya Kostarev
On 01/27/2017 05:20 PM, Ian Lance Taylor wrote: Please file an issue at https://golang.org/issue/new. Thanks. Ian Ian, done, issued. -- 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 i

Re: [go-nuts] Go 1.7.5 and Go 1.8rc3 are released

2017-01-27 Thread alb . donizetti
A better link is this one, IMHO: github.com/golang/go/compare/go1.7.4...go1.7.5 the gerrit one shows uninteresting CLs too, like: [release-branch.go1.7] cmd/godoc: add perf subrepo while the github one doesn't Il giorno venerdì 27 gennaio 2017 15:58:20 UTC+1, Steven Hartland ha scritto: > >

Re: [go-nuts] GOMAXPROCS survey

2017-01-27 Thread Sameer Ajmani
Inside Google. we automatically update GOMAXPROCS when the job management system indicates that the container resources have changed. This usually happens when with either the user or automatic systems update the container resources based on observed use. I would expect other job management syste

Re: [go-nuts] Go 1.7.5 and Go 1.8rc3 are released

2017-01-27 Thread Steven Hartland
Hi guys first off thanks for 1.7.5! Having reviewed the changes for the 1.7.5 milestone , which is the link provided for more info from the release notes, I feel that the its not as easy to follow as they have been for other milestones

[go-nuts] Re: http: Empty pattern

2017-01-27 Thread paraiso . marc
> What did I miss? nothing, there is plenty of routers that will do what you want : https://github.com/avelino/awesome-go#web-frameworks or just write a switch statement in your handler. the behavior of the default muxer is hardly going to change anyway, it would obviously be a breaking change

[go-nuts] AST to parse contents of Structs

2017-01-27 Thread Jeffrey Smith
I'm trying to use the ast and parse packages to find the fields in two separate structs one that will be called Inputs and the other Outputs. these can change but as an example i'm trying to parse these package main import ( "fmt" ) type Inputs struct { Name string `json:"name"`

Re: [go-nuts] testing.Benchmark Unanswered StackOverflow question. Looks like a bug.

2017-01-27 Thread Ian Lance Taylor
On Fri, Jan 27, 2017 at 1:15 AM, Ilya Kostarev wrote: > Just this > http://stackoverflow.com/questions/41861918/using-testing-benchmark-does-not-produce-any-output > Citation > > package main > > import "testing" > > func main() { > > result := testing.Benchmark(func(parentB *testing.B) { >

[go-nuts] Re: x/mobile/gl: blocking vs non-blocking calls

2017-01-27 Thread Roberto Zanotto
I misunderstood the purpose of the mechanism used for the gl calls. It is not to save cgo calls (in fact, it doesn't), it is to handle the fact that OpenGL wants to be called form a locked thread, as exemplified in: https://godoc.org/golang.org/x/mobile/gl#Worker On Thursday, January 26, 2017 at

[go-nuts] http: Empty pattern

2017-01-27 Thread 'Florian Uekermann' via golang-nuts
I tried googling this, but couldn't find anything. A common issue when using the http package and registering handles is the need to register a handler for "domain.com" that does not catch "domain.com/otherStuff". Since any pattern ending in a "/" matches paths prefixed with the pattern, providi

[go-nuts] [ANN] raylib-go: Go bindings for raylib, a simple and easy-to-use library to learn videogames programming

2017-01-27 Thread gen2brain
Golang bindings for http://www.raylib.com/ , a library to learn videogames programming. Raylib is highly inspired by BGI lib and XNA framework. It is written in plain C and by default compiles to single static library. Depends on GLFW3 (for desktop only) and OpenAL, both libs can also be easily

[go-nuts] testing.Benchmark Unanswered StackOverflow question. Looks like a bug.

2017-01-27 Thread Ilya Kostarev
Just this http://stackoverflow.com/questions/41861918/using-testing-benchmark-does-not-produce-any-output Citation |package main import "testing" func main() { result:= testing.Benchmark(func(parentB*testing.B) { parentB.Run("example", func(b*testing.B) { for n

Re: [go-nuts] GolangRT Docs?

2017-01-27 Thread Konstantin Khomoutov
On Thu, 26 Jan 2017 19:57:22 -0800 (PST) T L wrote: > > It depends. A call to new can (and will, often) give you a pointer > > to a stack allocated object. If you pass that pointer to something > > like fmt.Println() you'll see the object escape to the heap, get > > flagged by -m, and presumably