[go-nuts] Is there anything wrong with proxy.glang.org?

2019-09-27 Thread Darren Hoo
Try to get this package: $ go get -u github.com/bilibili/kratos/tool/kratos > go: finding github.com/bilibili/kratos v0.2.3 > go: downloading github.com/bilibili/kratos v0.2.3 > go: extracting github.com/bilibili/kratos v0.2.3 > go get: github.com/bilibili/kratos@v0.2.3 requires > golang.org/x

[go-nuts] http get news.kompas.com fails

2018-12-18 Thread Darren Hoo
Try to access https://news.kompas.com with http.Client code here: https://play.golang.org/p/lr71n5No_8Z It seems that tls handshake succeeds, but server does not write response?, it keeps retrying until timeouts: DNS Info: {Addrs:[{IP:202.146.4.17 Zone:}] Err: Coalesced:false} > Conn Done: > T

[go-nuts] Re: How can I get the last followed URL use http.Client on 302 Redirections?

2018-05-21 Thread Darren Hoo
Hi Dave, I haven't made it clear on the first post, sorry, I am talking about the behavior of Go's net/http.Client, so there are no browsers involved. Go's net/http.Client will do redirections transparently for user, but there are no exposed way of get the redirected url. see https://play.gol

[go-nuts] Re: How can I get the last followed URL use http.Client on 302 Redirections?

2018-05-20 Thread Darren Hoo
10 redirects") } return nil } On Monday, May 21, 2018 at 12:25:37 PM UTC+8, Darren Hoo wrote: > > if this is how the redirections go: > > A (original url) => B => C => D > > I want to know the url of request D > > the URL of A is never changed, and get

[go-nuts] How can I get the last followed URL use http.Client on 302 Redirections?

2018-05-20 Thread Darren Hoo
if this is how the redirections go: A (original url) => B => C => D I want to know the url of request D the URL of A is never changed, and get the Location header from request is impossible. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] question about func type

2017-07-05 Thread Darren Hoo
On Wed, Jul 5, 2017 at 5:27 PM, Jan Mercl <0xj...@gmail.com> wrote: > On Wed, Jul 5, 2017 at 11:03 AM Darren Hoo wrote: > > >>> what is the relation between `type literal` and `named type`, > >> > >> Orthogonality. > > > > Then `int` is not

Re: [go-nuts] question about func type

2017-07-05 Thread Darren Hoo
On Wed, Jul 5, 2017 at 5:06 PM, Jan Mercl <0xj...@gmail.com> wrote: > On Wed, Jul 5, 2017 at 11:03 AM Darren Hoo wrote: > > > what is the relation between `type literal` and `named type`, > > Orthogonality. > Then `int` is not named type. `int` and `int64` are

Re: [go-nuts] question about func type

2017-07-05 Thread Darren Hoo
On Wednesday, July 5, 2017 at 4:40:57 PM UTC+8, Jan Mercl wrote: > > On Wed, Jul 5, 2017 at 10:33 AM Darren Hoo > wrote: > > > So in https://talks.golang.org/2015/tricks.slide#5 > > > > Other examples of type literals are int and []string, > > > >

Re: [go-nuts] question about func type

2017-07-05 Thread Darren Hoo
Thanks all. I got it. So in https://talks.golang.org/2015/tricks.slide#5 > Other examples of type literals are int and []string, is actually not correct. On Wednesday, July 5, 2017 at 3:59:57 PM UTC+8, Jan Mercl wrote: > > On Wed, Jul 5, 2017 at 9:54 AM Darren Hoo > wrote:

Re: [go-nuts] question about func type

2017-07-05 Thread Darren Hoo
ednesday, July 5, 2017 at 3:26:13 PM UTC+8, Jan Mercl wrote: > > On Wed, Jul 5, 2017 at 9:17 AM Darren Hoo > wrote: > > > f1's type is func(int), and f2's type is main.f, they are different > types, does implicit conversion happen here? > > It's not

[go-nuts] question about func type

2017-07-05 Thread Darren Hoo
package main type u uint64 type f func(int) func g(x int) { } func main() { var a1 uint64 = 1000 var a2 u = a1 //why this is not OK var f1 func(int) = g var f2 f = f1 //while this is allowed? f2(1) } f1's type is func(int), and f2's type is main.f, they are different types, does implicit con

[go-nuts] talks.golang.org down?

2017-02-03 Thread Darren Hoo
Try to access https://talks.golang.org/ Error: Server ErrorThe service you requested is not available yet. Please try again in 30 seconds. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

[go-nuts] Re: Chrome not accepting generate_cert.go self-signed SSL certificate

2016-12-29 Thread Darren Hoo
Try starting chrome from command line with option --ignore-certificate-errors ? On Friday, March 13, 2015 at 7:19:07 PM UTC+8, Alex wrote: > > > I made a certificate with the generate_cert.go file in the http package, > and it works fine on firefox, but chrome wont accept it (with no options to

[go-nuts] context example and http.Request

2016-11-06 Thread Darren Hoo
I am trying to understand Context by reading https://blog.golang.org/context the code in https://blog.golang.org/context/google/google.go uses transport. CancelRequest Since http.Request now (I am using go 1.7.3) has context support now, I think the code can be simpler now. This is my version of

Re: [go-nuts] Re: SimpleHttpServer built into go toolchain?

2016-09-29 Thread Darren Hoo
erver isn't for production anyway. Best of luck in your > deployment. Maybe you'll be able to find a use case for Go in your future > endeavors. If not, that's cool too. Use the best tool to accomplish your > goals. :) > > On Thu, Sep 29, 2016, 9:16 PM Darren

[go-nuts] Re: SimpleHttpServer built into go toolchain?

2016-09-29 Thread Darren Hoo
ls to write exactly the program you want, >> then you can share it with the world via go get. >> >> On Friday, 30 September 2016 12:14:26 UTC+10, Darren Hoo wrote: >>> >>> One thing that I really like about python is this one command line to >>> serve

[go-nuts] SimpleHttpServer built into go toolchain?

2016-09-29 Thread Darren Hoo
One thing that I really like about python is this one command line to serve static files: python -m SimpleHTTPServer This is very convenient. Now I just want to use Go to do the same thing, I have to copy the snippet from https://github.com/golang/go/wiki/HttpStaticFiles and go run i

Re: [go-nuts] why this code deadlocks?

2016-09-01 Thread Darren Hoo
es are. It > would just be less deterministic. > > On Thu, Sep 1, 2016 at 10:38 AM Darren Hoo > wrote: > >> Got it, using buffered channel works for me >> >> ints := make(chan int, 1) >> done := make(chan bool, 1) >> >> go func() { >>

Re: [go-nuts] why this code deadlocks?

2016-09-01 Thread Darren Hoo
; exit status 2 > > main.go:25 is the line that says `done <- true`. > > The `done` channel isn't buffered and the first loop through will select > that path, but there is not another goroutine selecting from done. so f() > never returns. Deadlock. > > On Thu, Sep 1, 20

[go-nuts] why this code deadlocks?

2016-09-01 Thread Darren Hoo
var wg sync.WaitGroup ints := make(chan int, 1) done := make(chan bool) go func() { for i := 0; i < 3; i++ { ints <- i } close(ints) }() f := func() { wg.Add(1) defer wg.Done() for { i, ok := <-ints if !ok { done <- true return } } } exit: for { select { case <-done: break exit default: f() }

[go-nuts] Re: goimports has been updated

2016-07-15 Thread Darren Hoo
goimports won't remove empty lines. is that a feature? goimports on this: import ( "bufio" "fmt" "math" "strconv" "time" "math/rand" "os" ) will not become import ( "bufio" "fmt" "math" "math/rand" "os" "strconv" "time" ) On Friday, July 15, 2016 at 1:34:36 PM UTC+8, bradfitz wrote: > > goi