Reputation: 17648
I'm somewhat new to Go, so this could be a Go problem, rather than an IntelliJ one: I've just set up https://github.com/go-lang-plugin-org/go-lang-idea-plugin/ from the zipfile, in IntelliJ 14.
I found that the compiler is inconsistent with the syntax highlighter.
world, err := redis.String(c.Do("GET", "message1"))
if err != nil {
fmt.Println("key not found")
}
Yields the following error message.
*not enough arguments in call to Redis.String.
Looking closer at the call to Redis.String, it appears to take an interface+args.
func String(reply interface{}, err error) (string, error) {
....
return "", fmt.Errorf("redigo: unexpected type for String, got type %T", reply)
}
And thus, I'm able to trick the IDE into removing the rror message, by simply adding an "err" arg to the end of the call, like so:
world, err := redis.String(c.Do("GET", "message1"), err)
But Alas! This "fix" makes the go compiler unhappy... and it reports this message (even though the IntelliJ plugin does not interpret this as an error).
./t1.go:19: multiple-value c.Do() in single-value context
Any thoughts on why the IntelliJ Go Plugin wants two args, wheresas GoLang only wants one arg, for this function would be of great help.
Upvotes: 0
Views: 865