[go-nuts] Context on one-shot structs
Hi all, I'm looking into how contexts are used, and wondering: does anybody know of an idiomatic use of context on a struct for the sake of a one-shot? (a one-shot being some struct that gets used once, like an RPC or http request) For example, http.Request has a context on its struct. But, I think the context exists there for backwards compatibility reasons. I'm looking for a struct that has context on it specifically because the context is scoped to the lifetime of the request. Thanks! Jean -- 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/CADn7dfKfk5ZDLaYm26VkGYv5Yr62S_sVZ-2PXzM3tOUESpw5Pg%40mail.gmail.com.
[go-nuts] Re: Context on one-shot structs
Er, lifetime of the struct * On Tue, Jan 12, 2021 at 8:11 AM Jean de Klerk wrote: > Hi all, > > I'm looking into how contexts are used, and wondering: does anybody know > of an idiomatic use of context on a struct for the sake of a one-shot? > > (a one-shot being some struct that gets used once, like an RPC or http > request) > > For example, http.Request has a context on its struct. But, I think the > context exists there for backwards compatibility reasons. > > I'm looking for a struct that has context on it specifically because the > context is scoped to the lifetime of the request. > > Thanks! > Jean > -- 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/CADn7dfJcBBe2A4fvwFJ3axGhwmKh1GwgJoS19GZ4AVfPs6jqpA%40mail.gmail.com.
Re: [go-nuts] require statements in multi module repositories
Thanks a million Paul. Yes, they were resolved (for posterity, in https://github.com/golang/go/issues/28685). On Fri, Nov 9, 2018 at 10:11 AM, Paul Jolly wrote: > > I've played around with go modules in a multi module repository, and I'm > running into oddities. The main confusion is that I have this idea that any > package (and its subpackages) that has a go.mod file is a distinct, carved > out module that has no relation to its siblings and parent, even if they > happen to reside in the same repository and have their own go.mod files. > That does not seem to be the case, though. > > You are correct. Locally, there are no constraints on the > containment/nesting of modules. That is to say, a module that exists > in a sub directory of another module does not need to share the same > path prefix. > > In a remote VCS however, the containment is important if that VCS is > used as part of resolving a (custom) import path, and the go tool will > fail resolution if it not correct. > > > Questions: > > > > If pkg_a depends on pkg_b, I expect the go.mod in pkg_a to contain > "require github.com/jadekler/module-testing/pkg_b". This does not happen > when I `go mod init && go mod tidy`. Is that WAI? Why? > > If pkg_c depends on the parent module, I expect the go.mod in pkg_c to > contain "require github.com/jadekler/module-testing". This does not > happen when I `go mod init && go mod tidy`. Is that WAI? Why? > > I think these questions are answered in the GitHub issue you raised? > > Please say if not. > > Thanks, > > > Paul > -- 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.