我將文件重命名為文件,并將 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 mainimport ( "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 為什么構建錯誤?
2 回答

浮云間
TA貢獻1829條經驗 獲得超4個贊
需要注意的大小寫不同file和File。既然你談論重命名文件,我假設你的代碼真的很像
package main
import (
file "github.com/golangframework/File"
)
func main() {
File.ReadAllBytes("foo")
}
要么不重命名File模塊(除去file在進口),或稱其為file替代File。

紫衣仙女
TA貢獻1839條經驗 獲得超15個贊
哦,,,對不起,我檢查了 goroot scr,發現舊的 moetemplate.go 和 file.go 仍然存在
所以我刪除了那些,然后從 github 獲取,而不是好的
- 2 回答
- 0 關注
- 174 瀏覽
添加回答
舉報
0/150
提交
取消