在Gogland IDE中引入局部变量。

huangapple go评论84阅读模式
英文:

Introduce local variable in Gogland ide

问题

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

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

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

我应该使用哪个键来自动将局部变量分配给所有返回的值,而不是手动输入?(我尝试了ALT + Enter,但没有起作用,这是我在IntelliJ中使用的方法)

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

How to introduce local variables in Gogland IDE in MacOS ??

I'm having the below code and want introduce the local variables for all the return values returned through ParseKnowHosts function.

authorizedKeyBytes, error := ioutil.ReadFile(&quot;authorized_keys&quot;)
if error != nil {
	log.Fatal(error)
}
ssh.ParseKnownHosts(authorizedKeyBytes) // returns &lt;marker, hosts, key, pubKey, comment, rest&gt;

What key supposed to use for automatically assign local variables to all returned values like below instead typing manually ? (I tried ALT + Enter didnt worked, which is the one I use for IntelliJ)

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

答案1

得分: 2

你需要在Windows / Linux上使用CTRL+ALT+V(或在OS X上使用CMD+ALT+V),或者调用Refactor | Extract | Variable,然后从列表中选择函数调用,变量将会自动插入。

英文:

You need to use CTRL+ALT+V for Windows / Linux (or CMD+ALT+V on OS X) or invoke the Refactor | Extract | Variable and then select the function call from the list and the variables will be inserted for you.

huangapple
  • 本文由 发表于 2017年6月20日 23:56:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/44657806.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定