On Sun, Dec 27, 2020 at 6:42 PM Aidan Hahn <aidan@aidanis.online> wrote: > > I am writing a modification to the os package in which I would like to take > advantage of code from the os/signal package. Ive written the patch (modified > os/exec_posix.go) and as I expected none of the symbols from os/signal are > defined in the os package. My question is how I can import them? > > I have tried the following: > - import "os/signal": caused the build to hang, presumably due to circular > imports > - import "./signal": the import path included the vendor folder > - no import: none of the symbols were defined (Notify, Reset, and SIGTTOU) > > Sorry if I have overlooked something obvious here, but I do not see a > solution to importing code from a subpackage into the parent package.
I don't think you've overlooked anything obvious. Go doesn't have subpackages. The packages os and os/signal are two different packages, not a package and a subpackage. Go also doesn't permit circular imports. Since the os/signal package imports the os package, the os package can't import the os/signal package. So I don't know what you're trying to do, but there is no easy way for the os package to call functions like os/signal.Notify. Ian -- 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/CAOyqgcXu-Kq8CUAY_gF6B2UkzPnpFxF%3DwioHXgXaeY6OuPaKhA%40mail.gmail.com.