On Thu, Jul 21, 2022 at 11:42 AM TheDiveO <harald.albre...@gmx.net> wrote: > > Unfortunately, I cannot see how this is supposed to work with pkgsite. I > tried relative URLs, and these do not get recognized as valid links. So I > would need to hardwire the links to always refer to Google's pkgsite, which > defeats any different deployment and any host-local deployment while working > on the documentation in particular. Any idea how this could be made to work > without hardwiring the host and protocol?
I don't know of a way, sorry. Ian > On Wednesday, July 20, 2022 at 11:34:48 PM UTC+2 Ian Lance Taylor wrote: >> >> On Wed, Jul 20, 2022 at 11:07 AM TheDiveO <harald....@gmx.net> wrote: >> > >> > https://go.dev/doc/comment says: >> > >> > When referring to other packages, “pkg” can be either a full import path >> > or the assumed package name of an existing import. The assumed package >> > name is either the identifier in a renamed import or else the name assumed >> > by goimports. (Goimports inserts renamings when that assumption is not >> > correct, so this rule should work for essentially all Go code.) For >> > example, if the current package imports encoding/json, then >> > “[json.Decoder]” can be written in place of “[encoding/json.Decoder]” to >> > link to the docs for encoding/json’s Decoder. If different source files in >> > a package import different packages using the same name, then the >> > shorthand is ambiguous and cannot be used. >> > >> > Now I'm facing in my project github.com/thediveo/whalewatcher the >> > situation where in the top-package documentation I would like to reference >> > a sub package, github.com/thediveo/whalewatcher/watcher in particular. >> > >> > Unfortunately, I'm unable to import the watcher package from the top-level >> > whalewatcher package due to an import cycle. In fact, normal usage of the >> > whalewatcher and watcher packages by module users never results in an >> > import cycle. >> > >> > Is there some lesser known trick to avoid showing overly long import paths >> > in package references in doc comments in case the respective package >> > cannot be imported? >> >> No. >> >> For this kind of use case it may be slightly more palatable to use a >> reference link; see the Links section in https://go.dev/doc/comment. >> >> 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/358a1a0c-a3da-4d3c-9c8b-a4681b96f162n%40googlegroups.com. -- 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/CAOyqgcUzXS9cvm4y%2BeXANj%3Dr%3DvzWh98sXET7TTrnARL86g7iRQ%40mail.gmail.com.