我發現了以下錯誤下面導入代碼:導入和未使用的錯誤
代碼: 包主要
import (
"log"
"net/http"
"os"
"github.com/emicklei/go-restful"
"github.com/emicklei/go-restful/swagger"
"./api"
)
錯誤:
.\main.go:9: imported and not used: "_/c_/Users/aaaa/IdeaProjects/app/src/api"
是否有一個原因導入不工作,因爲我有package api
和文件存儲在api文件夾下?
我用下面使用api
在main.go
func main() {
// to see what happens in the package, uncomment the following
restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile))
wsContainer := restful.NewContainer()
api := ApiResource{map[string]OxiResp{}}
api.registerLogin(wsContainer)
api.registerAccount(wsContainer)
api.registerLostLogin(wsContainer)
api.registerWallet(wsContainer)
}