connectメソッド等をcontrollerで使おうとしており、そのためにはsqlのpackageが必要なのではないかと思い、
controllers/gorm.goに
import ( "database/sql" _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/gorm" "github.com/revel/revel" "myapp/app/models" "log" )
"database/sql"を追記し、importしようとしました。
するとエラーが出ます。
http://rabbitfoot141.hatenablog.com/entry/2019/03/05/000551
以上を少し参考にはしました。
エラー全文
Revel engine is NOT listening on.. localhost:58929 /Users/toshi/gocode/src/myapp/app/controllers/gorm.go ERROR 16:10:50 watcher.go:270: Build detected an error error="Go Compilation Error (in app/controllers/gorm.go:4): imported and not used: \"database/sql\"" /Users/toshi/gocode/src/myapp/app/controllers/gorm.go ERROR 16:11:49 watcher.go:270: Build detected an error error="Go Compilation Error (in app/controllers/gorm.go:4): imported and not used: \"database/sql\""
appのpathです。
/Users/toshi/gocode/src/myapp
sql driverまでのpathです。
/Users/toshi/gocode/src/github.com/go-sql-driver/mysql
あなたの回答
tips
プレビュー