[go-nuts] Is there anything wrong with proxy.glang.org?
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/time@v0.0.0-20190513212739-9d24e82272b4: invalid > pseudo-version: does not match version-control timestamp > (2019-03-08T20:28:27Z) it reports golang.org/x/time@v0.0.0-20190513212739-9d24e82272b4: invalid > pseudo-version: does not match version-control timestamp > (2019-03-08T20:28:27Z) go get trying to access this url: https://proxy.golang.org/golang.org/x/time/@v/v0.0.0-20190513212739-9d24e82272b4.mod it returns *not found: golang.org/x/time@v0.0.0-20190513212739-9d24e82272b4: invalid > pseudo-version: does not match version-control timestamp > (2019-03-08T20:28:27Z)* While both (replace proxy.golang.org with goproxy.io or goproxy.cn) https://goproxy.io/golang.org/x/time/@v/v0.0.0-20190513212739-9d24e82272b4.mod https://goproxy.cn/golang.org/x/time/@v/v0.0.0-20190513212739-9d24e82272b4.mod returns OK with: *module golang.org/x/time* -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3764b8ea-1882-4b19-9d0b-3cb836a46c6e%40googlegroups.com.
[go-nuts] http get news.kompas.com fails
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: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc00012 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.146.4.17 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0001c2000 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.146.4.17 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0002da000 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0001c2700 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0001c2a80 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0001c3180 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0001c3880 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0004f4000 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0002daa80 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > TLSHandshakeDone version:771 > Got Conn: {Conn:0xc0002db180 Reused:false WasIdle:false IdleTime:0s} > Request written :{} > DNS Info: {Addrs:[{IP:202.61.113.151 Zone:}] Err: Coalesced:false} > Conn Done: > 2018/12/19 12:18:33 context deadline exceeded > exit status 1 while curl works, curl -v https://news.kompas.com : * Trying 202.61.113.151... > * TCP_NODELAY set > * Connected to news.kompas.com (202.61.113.151) port 443 (#0) > * ALPN, offering h2 > * ALPN, offering http/1.1 > * Cipher selection: > ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH > * successfully set certificate verify locations: > * CAfile: /etc/ssl/cert.pem > CApath: none > * TLSv1.2 (OUT), TLS handshake, Client hello (1): > * TLSv1.2 (IN), TLS handshake, Server hello (2): > * TLSv1.2 (IN), TLS handshake, Certificate (11): > * TLSv1.2 (IN), TLS handshake, Server key exchange (12): > * TLSv1.2 (IN), TLS handshake, Server finished (14): > * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): > * TLSv1.2 (OUT), TLS change cipher, Client hello (1): > * TLSv1.2 (OUT), TLS handshake, Finished (20): > * TLSv1.2 (IN), TLS change cipher, Client hello (1): > * TLSv1.2 (IN), TLS handshake, Finished (20): > * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 > * ALPN, server accepted to use h2 > * Server certificate: > * subject: CN=*.kompas.com > * start date: Mar 12 00:00:00 2018 GMT > * expire date: May 26 12:00:00 2019 GMT > * subjectAltName: host "news.kompas.com" matched cert's "*.kompas.com" > * issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=Thawte RSA CA > 2018 > * SSL certificate verify ok. > * Using HTTP2, server supports multi-use > * Connection state changed (HTTP/2 confirmed) > * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: > len=0 > * Using Stream ID: 1 (easy handle 0x7f9a3600ae00) > > GET / HTTP/2 > > Host: news.kompas.com > > User-Agent: curl/7.54.0 > > Accept: */* > > > * Connection state changed (MAX_CONCURRENT_STREAMS updated)! > < HTTP/2 200 > < date: Wed, 19 Dec 2018 04:15:23 GMT > < content-type: text/html; charset=UTF-8 > < access-control-allow-origin: * > < set-cookie: > TS015067b4=01402378ceafba01fa49688c625772d92bd5247645b485bf2fda669e55577d9f70c55fdd498a2d6e750b05204473566462d6ae2e4b; > > Path=/; Domain=.news.kompas.com > < vary: Accept-Encoding -- 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 https://groups.google.com/d/optout.
[go-nuts] Re: How can I get the last followed URL use http.Client on 302 Redirections?
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.golang.org/p/jLlKR3yjWSw , that explains what I want to achieve. On Monday, May 21, 2018 at 4:25:05 PM UTC+8, Dave Cheney wrote: > > Please keep in mind that the Via header is supplied by he client (the > browser) and there is not requirement that it maintains the full chain of > custardy of all the urls it has passed though, nor is there any way for Go > to know nor enforce that this list remains accurate. Sorry. -- 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 https://groups.google.com/d/optout.
[go-nuts] Re: How can I get the last followed URL use http.Client on 302 Redirections?
Found a hacky solution, https://play.golang.org/p/jLlKR3yjWSw Any better ideas? var client = { CheckRedirect: setFollowURL, } func setFollowURL(req *http.Request, via []*http.Request) error { via[0].URL = req.URL if len(via) >= 10 { return errors.New("stopped after 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 the Location header from request is > impossible. > -- 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 https://groups.google.com/d/optout.
[go-nuts] How can I get the last followed URL use http.Client on 302 Redirections?
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 unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] question about func type
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 <darren@gmail.com> wrote: > > >>> what is the relation between `type literal` and `named type`, > >> > >> Orthogonality. > > > > Then `int` is not named type. > > Please explain why do you think so. I don't get it. > In https://talks.golang.org/2015/tricks.slide#5 says int is type literal, then you say int is named type. How can int be both type literal and named type while they are orthogonal? Can you explain orthogonality for me? Thanks! -- 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 https://groups.google.com/d/optout.
Re: [go-nuts] question about func type
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 <darren@gmail.com> wrote: > > > what is the relation between `type literal` and `named type`, > > Orthogonality. > Then `int` is not named type. `int` and `int64` are not the same in this regard? -- 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 https://groups.google.com/d/optout.
Re: [go-nuts] question about func type
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 <darre...@gmail.com > > wrote: > > > So in https://talks.golang.org/2015/tricks.slide#5 > > > > Other examples of type literals are int and []string, > > > > is actually not correct. > > The text is completely correct. Type literal is like a type expression. To > express/describe a type you can use any type, anonymous or named. > 'u' and 'int64' are both named types. `int` is type literal `int64` is named type IIUC, `func (int)` is type literal but not named type what is the relation between `type literal` and `named type`, aren't they mutually exclusive? -- 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 https://groups.google.com/d/optout.
Re: [go-nuts] question about func type
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 <darre...@gmail.com > > wrote: > > > which part did I misunderstand? > > 'u' and 'int64' are both named types. > > > > -- > > -j > -- 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 https://groups.google.com/d/optout.
Re: [go-nuts] question about func type
Thank you all! But I still don't quite understand why the rule does not apply to the first case? var a2 u = a1 x ---> a1 T ---> u V ---> uint64 V and T has the identical underlying types (ie, uint64) and V is not a named type (literal) . which part did I misunderstand? On Wednesday, July 5, 2017 at 3:26:13 PM UTC+8, Jan Mercl wrote: > > On Wed, Jul 5, 2017 at 9:17 AM Darren Hoo <darre...@gmail.com > > 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 a conversion. The rule is about assignability > <https://golang.org/ref/spec#Assignability>: "x's type V and T have > identical underlying types <https://golang.org/ref/spec#Types> and at > least one of V or T is not a named type > <https://golang.org/ref/spec#Types>." > > -- > > -j > -- 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 https://groups.google.com/d/optout.
[go-nuts] question about func type
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 conversion happen here? -- 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 https://groups.google.com/d/optout.
[go-nuts] talks.golang.org down?
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 from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: Chrome not accepting generate_cert.go self-signed SSL certificate
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 > allow), and I cant find it in the certificates settings in chrome to > manually allow the certificate either. > > I used the -ca=true flag when creating the certificate. > > Does anyone know if there is something I can modify when creating the > certificate to make it work in chrome? > > Thanks, > -- 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 https://groups.google.com/d/optout.
[go-nuts] context example and http.Request
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 Search: https://play.golang.org/p/EaHrbogwM9 // Search sends query to Google search and returns the results. func Search(ctx context.Context, query string) (Results, error) { // Prepare the Google Search API request. req, err := http.NewRequest("GET", "https://ajax.googleapis.com/ajax/services/search/web?v=1.0;, nil) if err != nil { return nil, err } q := req.URL.Query() q.Set("q", query) // If ctx is carrying the user IP address, forward it to the server. // Google APIs use the user IP to distinguish server-initiated requests // from end-user requests. if userIP, ok := userip.FromContext(ctx); ok { q.Set("userip", userIP.String()) } req.URL.RawQuery = q.Encode() // Issue the HTTP request and handle the response. The httpDo function // cancels the request if ctx.Done is closed. var results Results client := {} req = req.WithContext(ctx) resp, err := client.Do(req) if err != nil { return nil, err } defer resp.Body.Close() // Parse the JSON search result. // https://developers.google.com/web-search/docs/#fonje var data struct { ResponseData struct { Results []struct { TitleNoFormatting string URL string } } } if err := json.NewDecoder(resp.Body).Decode(); err != nil { return nil, err } for _, res := range data.ResponseData.Results { results = append(results, Result{Title: res.TitleNoFormatting, URL: res.URL}) } return results, nil } But it does not work correctly, first search after `go run server.go` curl 'http://localhost:8080/search?q=golang=1s' will give `context deadline exceeded` but after that repeated searches will not return context deadline. what's wrong? -- 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 https://groups.google.com/d/optout.
Re: [go-nuts] Re: SimpleHttpServer built into go toolchain?
But static binary is way bigger than 10loc snippet, if I compile it to binary which is 6.7 megabytes in size on my laptop, and then scp to my server, it takes 10 minutes to upload meanwhile I can not do anything on the server because my network is saturated during uploading. The case with SimpleHTTPServer is certainly not a production usage. Actually We built a server using net/http which handle 30 billion requests per day without any problems, and we use http.ServeContent for serivng static files. net/http is really good for us and we don't use nginx all. We just use LVS plus six backend servers. With regard to "production ready", someone suggests not using Go's tls: https://github.com/golang/go/issues/17053#issuecomment-246834654. I think It's kind of FUD.Not only do we use Go's https, we used it happyily and believe Go team can respond quickly to any possible security problems. On Friday, September 30, 2016 at 12:27:29 PM UTC+8, Harley Laue wrote: > > Go does build as a static binary. However, if all you're doing in > production is serving static files, nginx is a better solution. Python and > SimpleHTTPServer 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 Hoo <darre...@gmail.com > > wrote: > >> Sure, for my development environment, I can do all this.. >> >> But on a server with only Go installed, in order to use go get, I have >> to setup GOPATH, I have to installed git. And I have to cross the great >> firewall of china. >> >> Oh my god, thank you guys. forget what I said. Go is not built for doing >> such a simple thing. >> >> To myself: Man!, just stick with Python >> >> >> On Friday, September 30, 2016 at 11:43:29 AM UTC+8, Diego Medina wrote: >>> >>> Hi, >>> >>> If you don't want to have to copy/paste that snippet of code on a new >>> laptop/OS install, I have been using: >>> >>> $ go get github.com/rif/spark >>> $ spark static_site/ >>> >>> for the last couple of years, works great, it's simple. >>> >>> https://github.com/rif/spark >>> >>> Regards, >>> >>> Diego >>> >>> On Thursday, September 29, 2016 at 11:10:29 PM UTC-4, Dave Cheney wrote: >>>> >>>> > Since Go is battery included and http is part of its core library, >>>> >>>> We said batteries, not the kitchen sink. >>>> >>>> But seriously, the standard library gives you the components to build >>>> these tools yourself. If the Go distro included a http server that just >>>> served static files, while this would be perfect for your use case, others >>>> who wanted a server that forwarded to FastCGI would be incensed that Go >>>> shipped with such a limited tool, and furthermore we refused to improve >>>> it. >>>> It's better to give you the tools 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 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 it. >>>>> >>>>> >>>>> Since Go is battery included and http is part of its core library, >>>>> why not >>>>> >>>>> just build it into the Go toolchain, So every time I want to serve >>>>> static files, >>>>> >>>>> I can fire up go like this: >>>>> >>>>> >>>>> go tool http /usr/share/doc >>>>> >>>>> >>>>> go tool http --addr=: /usr/share/doc >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >> 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...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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 https://groups.google.com/d/optout.
[go-nuts] Re: SimpleHttpServer built into go toolchain?
Sure, for my development environment, I can do all this.. But on a server with only Go installed, in order to use go get, I have to setup GOPATH, I have to installed git. And I have to cross the great firewall of china. Oh my god, thank you guys. forget what I said. Go is not built for doing such a simple thing. To myself: Man!, just stick with Python On Friday, September 30, 2016 at 11:43:29 AM UTC+8, Diego Medina wrote: > > Hi, > > If you don't want to have to copy/paste that snippet of code on a new > laptop/OS install, I have been using: > > $ go get github.com/rif/spark > $ spark static_site/ > > for the last couple of years, works great, it's simple. > > https://github.com/rif/spark > > Regards, > > Diego > > On Thursday, September 29, 2016 at 11:10:29 PM UTC-4, Dave Cheney wrote: >> >> > Since Go is battery included and http is part of its core library, >> >> We said batteries, not the kitchen sink. >> >> But seriously, the standard library gives you the components to build >> these tools yourself. If the Go distro included a http server that just >> served static files, while this would be perfect for your use case, others >> who wanted a server that forwarded to FastCGI would be incensed that Go >> shipped with such a limited tool, and furthermore we refused to improve it. >> It's better to give you the tools 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 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 it. >>> >>> >>> Since Go is battery included and http is part of its core library, why >>> not >>> >>> just build it into the Go toolchain, So every time I want to serve >>> static files, >>> >>> I can fire up go like this: >>> >>> >>> go tool http /usr/share/doc >>> >>> >>> go tool http --addr=: /usr/share/doc >>> >>> >>> >>> >>> >>> -- 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 https://groups.google.com/d/optout.
[go-nuts] SimpleHttpServer built into go toolchain?
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 it. Since Go is battery included and http is part of its core library, why not just build it into the Go toolchain, So every time I want to serve static files, I can fire up go like this: go tool http /usr/share/doc go tool http --addr=: /usr/share/doc -- 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 https://groups.google.com/d/optout.
[go-nuts] why this code deadlocks?
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() } } wg.Wait() -- 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 https://groups.google.com/d/optout.