sargas
sargas

Reputation: 6180

How to list interfaces satisfied by a type in a CLI?

I'm being unsuccessful in using the following command:

oracle -pos=$GOPATH/src/path/to/project/vendor/github.com/quickfixgo/quickfix/null_log.go#3 implements

To which I get the error:

oracle: invalid source position -pos=$GOPATH/src/path/to/project/vendor/github.com/quickfixgo/quickfix/null_log.go#3

I want to list the interfaces satisfied by the nullLog struct found on the 3rd line of the package found in the path above.

If oracle is the right tool for my problem, how can I use it properly? If not, is there another tool I can use to accomplish this?

Upvotes: 1

Views: 126

Answers (1)

Thundercat
Thundercat

Reputation: 120979

Use the following command:

oracle -pos=$GOPATH/src/path/to/project/vendor/github.com/quickfixgo/quickfix/null_log.go:#20 implements

Note the ":" and that position is a byte offset in the file.

The oracle tool is intended to be used from an editor plugin where the plugin calculates the offset in the file.

Here's the output when I run the tool using the current version of quickfix:

$ oracle -pos=$GOPATH/src/github.com/quickfixgo/quickfix/null_log.go:#20 implements
/Users/muffin/gopath/src/github.com/quickfixgo/quickfix/null_log.go:3:6: struct type nullLog
/Users/muffin/gopath/src/github.com/quickfixgo/quickfix/log.go:4:6:     implements Log

Upvotes: 1

Related Questions