“variable declared and not used” compilation error

后端 未结 6 1073
遥遥无期
遥遥无期 2021-01-12 07:04

I am learning Google\'s new language Go. I am just trying stuff out and I noticed that if you declare a variable and do not do anything with it the go compiler (8g

6条回答
  •  一个人的身影
    2021-01-12 07:48

    You could try this:

    cwd, _ := os.Getwd();
    

    but it seems like it would be better to keep the error like in Jurily's answer so you know if something went wrong.

提交回复
热议问题