-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Scenario: editing a .go file that's hasn't been saved yet. (For example, for rapid greenfield prototyping of stuff via some sort of go run-based REPL-ish tool like gore.) The source is sent as usual via -modified flag and stdin archive format. When -pos is something like Untitled-1.go:#pos, all documentation requests via -json (say, hovering over the strings.ToLower or anything that should have docs) will always return couldn't find Untitled-1 in program. Or if name is empty, similarly couldn't find in program (2 spaces).
Here's an easy-repro session:
[23:42 me ~/.../github.com/metaleap]$ gogetdoc -json -modified -pos untitled.go:#94
untitled.go
136
package tmp
import "strings"
func test (val string) string {
if val[0]=='u' {return strings.ToUpper(val)}
return "Nope not happn'g"
}
gogetdoc: couldn't find untitled.go in program
[23:49 me ~/.../github.com/metaleap]$
Of course no file named untitled.go exists on disk, but would be awesome if gogetdoc could handle that, given that it read the program from stdin anyway! The given -pos 94 should be between the T and o of ToUpper if my editor didn't fool me.