zmb3/gogetdoc

No documentation found when requesting documentation for symbol not imported directly

creker opened this issue · 0 comments

Given the following project in GOPATH

.
├── main.go
└── prom
    └── metrics.go
//main.go
package main

import (
	"gogetdocbug/prom"
	//_ "github.com/prometheus/client_golang/prometheus"
)

func main() {
	//gogetdoc this line
	prom.Metric.Inc()
}
//prom/metrics.go
package prom

import (
	"github.com/prometheus/client_golang/prometheus"
)

//this works
var Metric prometheus.Counter

If I execute gogetdoc -pos main.go:#145, which points to .Metric, I get correct results

import "gogetdocbug/prom"

var Metric *CounterVec

this works

But gogetdoc -pos main.go:#150, which points to .Inc, returns

no documentation found for Inc

If I uncomment import tag, the same command returns correct results. It looks like this is not limited to prometheus but happens in general when you request documentation for symbol that's from a package not imported directly.

go version go1.11.2 darwin/amd64
gogetdoc is on the latest version