在Gogland ide

时间:2017-06-20 15:56:24

标签: go intellij-idea goland

如何在MacOS中的Gogland IDE中引入局部变量?

我有以下代码,并希望为通过ParseKnowHosts函数返回的所有返回值引入局部变量。

authorizedKeyBytes, error := ioutil.ReadFile("authorized_keys")
if error != nil {
    log.Fatal(error)
}
ssh.ParseKnownHosts(authorizedKeyBytes) // returns <marker, hosts, key, pubKey, comment, rest>

应该使用什么键自动将局部变量分配给所有返回值,如下所示而不是手动输入? (我试过ALT + Enter didnt work,这是我用于IntelliJ的那个)

marker, hosts, key, pubKey, comment, rest := ssh.ParseKnownHosts(authorizedKeyBytes)

1 个答案:

答案 0 :(得分:1)

您需要在Windows / Linux上使用CTRL + ALT + V(或在OS X上使用CMD + ALT + V)或调用Refactor |提取|变量然后从列表中选择函数调用,并为您插入变量。