Don't do it. Don't fight the Go tools. Use them the way they are intended. They are your friends. Put all your package files in a single directory. Or break them up into multiple packages. That is the way everyone else write Go. If you follow the convention, your life will be simpler, and your code will be easier for others to understand and maintain.
On Tuesday, 22 November 2022 at 01:15:33 UTC jlfo...@berkeley.edu wrote: > Back in June I asked why Go requires all the files in a package to be in > the same > directory. I learned that this is an implementation-specific decision. I > was also referred to > > > https://stackoverflow.com/questions/45899203/can-i-develop-a-go-package-in-multiple-source-directories > > which discusses this. Someone named "Volker" in this posting said > > "Yes, this is doable without any problems, just invoke the Go compiler by > hand, that is not > via the go tool." > > I'm wondering how to actually do this. Suppose I have a directory, which > contains several > subdirectories. There are .go files in all these directories that I'd like > to use to make a > single package. How could I invoke to Go compiler by hand to make this > happen? > (I've tried adding the "-x" flag to "go build" but I don't see which > arguments I'd need to > change to do what I'm trying to accomplish). Volker says "It's complicated > ". > > Also, let's say I was able to figure this out. Would using such a package > confuse any of > the other commands in the Go tool chain or the dlv debugger? > > Cordially, > Jon Forrest > > > -- 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/f4f1dca8-6e19-4f71-9a62-45097cf43872n%40googlegroups.com.