Documentation On “All Known Implementation” of Interfaces

后端 未结 3 1600
礼貌的吻别
礼貌的吻别 2021-02-05 18:03

Few months into learning Go, I just discover that os.File implements the io.Reader interface by implementing the Read(b []byte) (n int, err error) function. This allows me to us

3条回答
  •  孤街浪徒
    2021-02-05 18:48

    You can find the info you want and more using the godoc command's static analysis tools. Run the following at the command line: godoc -http=":8080" -analysis="type". Using the documentation you can find out what types implement an interface and the method set for a type.

    There is also a pointer analysis that allows you to find callers and callees of various types. The channel send<--->receive analysis is pretty neat.

    You can also read more about the static analysis done by the godoc tool at http://golang.org/lib/godoc/analysis/help.html

提交回复
热议问题