文件或目录的通用变量名是"PATH".不幸的是,这也是围棋中一个套餐的名字.此外,在doit中将path更改为参数名,如何编译此代码?
package main
import (
"path"
"os"
)
func main() {
DoIt("file.txt")
}
func DoIt(path string) {
path.Join(os.TempDir(), path)
}
我得到的错误是:
$6g pathvar.go
pathvar.go:4: imported and not used: path
pathvar.go:13: path.Join undefined (type string has no field or method Join)