我将文件重命名为File,并将moetemplate重命名为htmlparts 然后去构建
./router.go:8: imported and not used: "github.com/golangframework/File" as file
./router.go:11: imported and not used: "github.com/golangframework/htmlparts" as moetemplate
./router.go:21: undefined: File in File.ReadAllBytes
./router.go:61: undefined: htmlparts in htmlparts.LoadPartFile
./router.go:62: undefined: File in File.ReadAllText
./router.go:65: undefined: htmlparts in htmlparts.Render
我的导入就是这个
package main
import (
"encoding/json"
"log"
"net/http"
"github.com/golangframework/File"
"github.com/golangframework/JSON"
"github.com/golangframework/Object"
"github.com/golangframework/htmlparts"
"github.com/golangframework/httpmongo"
"github.com/golangframework/moeregexp"
)
我还清理了goroot pkg,更新了src 为什么要构建错误?
答案 0 :(得分:2)
请注意file
和File
的不同大小写。既然你谈到重命名文件,我假设你的代码真的像
package main
import (
file "github.com/golangframework/File"
)
func main() {
File.ReadAllBytes("foo")
}
要么不要重命名您的File
模块(移除导入中的file
),要么将其引用为file
而不是File
。
答案 1 :(得分:0)
哦,,,抱歉,我检查了goroot scr,发现旧的moetemplate.go和file.go仍然存在
所以我删除了那些,然后从github获取,而不是OK