Exemple #1
0
func packageDir(dctx *doc.Environment, p string) string {
	if strings.IndexByte(p, '.') > 0 {
		// Non std package
		return dctx.Join(dctx.Context.GOPATH, "src", p)
	}
	// Std package
	if strings.HasPrefix(p, "cmd") {
		return dctx.Join(dctx.Context.GOROOT, "src", p)
	}
	// pkg was removed from path to the source around go 1.4
	stdSrc := dctx.Join(dctx.Context.GOROOT, "src", "pkg")
	if !dctx.IsDir(stdSrc) {
		stdSrc = dctx.Join(dctx.Context.GOROOT, "src")
	}
	return dctx.Join(stdSrc, p)
}