英文:
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("authorized_keys")
if error != nil {
log.Fatal(error)
}
ssh.ParseKnownHosts(authorizedKeyBytes) // returns <marker, hosts, key, pubKey, comment, rest>
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论