カテゴリー:
学習
閲覧数:344 配信日:2017-12-15 12:56
echoインストール
$ go get -u github.com/labstack/echo/
$ cd /home/★★/go/src/try-using-echo/chapter-1/templates
$ go run main.go
../../../github.com/labstack/echo/middleware/jwt.go:9:2: cannot find package "github.com/dgrijalva/jwt-go" in any of:
/usr/local/go/src/github.com/dgrijalva/jwt-go (from $GOROOT)
/home/★★/go/src/github.com/dgrijalva/jwt-go (from $GOPATH)
jwt-goインストール
$ go get github.com/dgrijalva/jwt-go
$ go run main.go
panic: open templates/layout.html: no such file or directory
goroutine 1 [running]:
html/template.Must(0x0, 0xa0b340, 0xc42006f3e0, 0x0)
/usr/local/go/src/html/template/template.go:364 +0x54
main.loadTemplates()
/home/★★/go/src/try-using-echo/chapter-1/templates/main.go:58 +0x10a
main.init.0()
/home/★★/go/src/try-using-echo/chapter-1/templates/main.go:51 +0x20
main.init()
<autogenerated>:1 +0x5d
exit status 2
エラー対応
ディレクトリ階層が異なっていたため、修正
$ cd ../
$ go run main.go
____ __
/ __/___/ / ___
/ _// __/ _ \/ _ \
/___/\__/_//_/\___/ v3.2.5
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
O\
⇨ http server started on [::]:3000
結果
コマンド画面を見ると成功しているようだが、ブラウザ画面には何も表示されない