On Wed, Jan 29, 2020 at 11:05 PM Axel Wagner <axel.wagner...@googlemail.com> wrote: > On Wed, Jan 29, 2020 at 12:57 PM Nigel Tao <nigel...@golang.org> wrote: >> For example, the https://golang.org/pkg/io/#LimitedReader struct just >> exports its fields, and you use it like this >> (https://go.googlesource.com/go/+/refs/heads/master/src/io/io_test.go#39). >> There is no io.NewLimitedReader function. > > Nit: It's not called that way, but there is.
Indeed, you are right and I am wrong. Perhaps https://golang.org/pkg/net/http/#Server is a better example. There is e.g. a ReadTimeout exported field (amongst many configuration parameters), but there is no http.NewServer function, let alone one that takes all of the various config params. Instead, as the Overview section of https://golang.org/pkg/net/http/ says: ``` More control over the server's behavior is available by creating a custom Server: s := &http.Server{ Addr: ":8080", Handler: myHandler, ReadTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second, MaxHeaderBytes: 1 << 20, } log.Fatal(s.ListenAndServe()) ``` -- 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/CAOeFMNUwFQuXiL1Ktn6ZB%2BjHqpXu8riVDbJKhcipj3aXtAV%3DQw%40mail.gmail.com.