Re: [go-nuts] Re: [ANN] reverse proxy with ssl in less than 100 lines of code

2018-01-02 Thread paul . totterman
> > You may want to investigate HPKP as well. > HPKP is on its way out: https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning#Browser_support Cheers, Paul -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: Selenium webdriver based testing in Go

2018-01-02 Thread Miki Tebeka
Original author of github.com/tebeka/selenium here. Currently maintained by the awesome Eric Garrido and IMO actively used inside Google for testing. I mostly wrote tests in Go, not using the IDE. On Monday, January 1, 2018 at 12:55:39 AM UTC+2, Tong Sun wrote: > > Hi, > > Anyone here ever

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread Tong Sun
On Tue, Jan 2, 2018 at 11:33 PM, Dave Cheney wrote: > Put your methods on *MyTokenizer. > Yeah, that works for the struct but not for interface: *TokenVisitor is pointer to interface, not interface > On Wednesday, 3 January 2018 14:52:41 UTC+11, Tong Sun wrote: >> >> I gave

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread Dave Cheney
Put your methods on *MyTokenizer. On Wednesday, 3 January 2018 14:52:41 UTC+11, Tong Sun wrote: > > I gave it a try, but unfortunately, it doesn't work for me. > > To begin with, this works, > > type MyTokenizer struct { > *html.Tokenizer > } > > func NewMyTokenizer(i io.Reader)

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread Tong Sun
I gave it a try, but unfortunately, it doesn't work for me. To begin with, this works, type MyTokenizer struct { *html.Tokenizer } func NewMyTokenizer(i io.Reader) *MyTokenizer { z := html.NewTokenizer(i) return {z} } However, On Tue, Jan 2, 2018 at 10:26 AM,

[go-nuts] The side effect of calling html.Token()

2018-01-02 Thread Tong Sun
Hi, For golang.org/x/net/html, both Token() and Next() advance the token to the next, right? https://godoc.org/golang.org/x/net/html#Token > Token returns the next Token. What's the advantages of having them doing the same thing, while lacking one function to return the current token? Is

[go-nuts] Re: database/sql left join best practicea for null values

2018-01-02 Thread meybohm
Just found myself in the same situation wondering that this should not be so complicated. What did you end up doing may I ask? On Tuesday, 25 April 2017 09:29:24 UTC+2, slinso wrote: > > What's a nice way to handle left joins with database/sql? Imagine you have > a users who can optional have

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread matthewjuran
If the calling function needs more than the interface methods (such as access to type-specific struct fields) then an approach is to use an interface type switch for per-type behavior: https://tour.golang.org/methods/16 Matt On Tuesday, January 2, 2018 at 1:05:22 PM UTC-6, Tong Sun wrote: > >

[go-nuts] Re: Why does http client try to connect via IPv6 address when IPv6 is not enabled on machine

2018-01-02 Thread James Bardin
The net dialer sorts the addresses according to RFC6724, which means that since you don't have ipv6 enabled they go to the end of the list, but doesn't remove them entirely. Also if you're using the DefaultTransport from the net/http package, it has DualStack enabled which means that ipv4 and

[go-nuts] Re: Matrix Operation

2018-01-02 Thread Jason E. Aten
https://rosettacode.org/wiki/QR_decomposition#Go -- 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,

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread Tong Sun
Oh Thanks Matt, when Ian explained to me, I didn't think it'd work, but on seeing your code illustration, I now think it works perfectly for *this* case. Just that this function approach will break if there are many base class member fields that need to be accessed, as type methods can access

[go-nuts] Re: Channels vs Callbacks in API

2018-01-02 Thread Jason E. Aten
On Friday, December 29, 2017 at 3:33:15 PM UTC-6, dc0d wrote: > > The statement being made here: a receive only channel, as a return value > of a function, in an API, is not bad. > > Reasoning: > > >- can not be closed >- can not be set to nil >- it's more clear than callbacks >

Re: [go-nuts] Channels vs Callbacks in API

2018-01-02 Thread 'Bryan Mills' via golang-nuts
In some cases, a synchronous callback can be a fine choice: consider filepath.Walk . A synchronous callback does not require any extra goroutines, and if the caller needs to adapt it to work with a channel (or perform longer-duration processing

[go-nuts] UK Go Conference

2018-01-02 Thread Calum Shaw-Mackay
Apologies one and all if this appears a little off topic. My company is currently looking at training budgets etc for the coming year, and I was wondering if anyone who had gone to the UK Go Conference in August, could tell me what the ticket prices were for the conference. Thanks Calum --

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread matthewjuran
You want different tokenizer types to be used in the same WalkBody implementation. Interfaces abstract the implementation from the calling computation. I think Ian did answer your question. type TokenVisitor interface { VisitToken() } func WalkBody(of TokenVisitor) { // here you call

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread Tong Sun
On Mon, Jan 1, 2018 at 9:46 PM, Tong Sun wrote: > Hi, > > I think I generally understand how embedding (https://golang.org/doc/ > effective_go.html#embedding) works in GO. > However, when it comes to the following problem, I'm at lost again. > > I'm trying to extend the

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread Tong Sun
On Tue, Jan 2, 2018 at 8:56 AM, Ian Lance Taylor wrote: > On Mon, Jan 1, 2018 at 8:13 PM, Tong Sun wrote: > > >> > >> Then your WalkBody function will take a TokenVisitor, and your > >> different types will implement different VisitToken methods. > >> >

[go-nuts] Re: static analysis tool for detecting unclosed io.Closer's

2018-01-02 Thread Fabien
Hello, Detecting all unclosed Closers in any case sounds a bit undecidable to me (sounds like the halting problem). But detecting some of them would be feasible. Le jeudi 28 décembre 2017 17:58:06 UTC+1, Brian Sorahan a écrit : > > That seems like a decent affirmation! Thanks. > > On

Re: [go-nuts] Extending an existing type by embedding

2018-01-02 Thread Ian Lance Taylor
On Mon, Jan 1, 2018 at 8:13 PM, Tong Sun wrote: > > Are just the last two attempts that I make, apart from many other failed > attempts that I've lost track of, but neither compiles. Thanks. It helps to know that the problem is that the code does not compile. I see that

Re: [go-nuts] Matrix Operation

2018-01-02 Thread Ian Davis
Try gonum https://godoc.org/gonum.org/v1/gonum/mat On Tue, 2 Jan 2018, at 10:58 AM, meher akshay wrote: > Hi everyone, > > I want to find the eigen vectors and values of a matrix in golang. > Please help me as I am not able to do it using the provided docs > > Thanks > > -- > You

[go-nuts] Matrix Operation

2018-01-02 Thread meher akshay
Hi everyone, I want to find the eigen vectors and values of a matrix in golang. Please help me as I am not able to do it using the provided docs Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] How to know if interface{} data is nil w/o reflecting?

2018-01-02 Thread David Collier-Brown
I was responding to the case where one is passed an interface, expects it to contain a typed value, and it does not. --dave -- 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