“variable declared and not used” compilation error

后端 未结 6 1069
遥遥无期
遥遥无期 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 08:00

    Does this work?

    cwd, error := os.Getwd();
    if error == nil {
        fmt.Printf(cwd);
    }
    

提交回复
热议问题