万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    ginルーティングでかぶる時

    以下のように、ルーティング設定すると、

    controller.Router.GET("/shops/:shop_id", controller.getShop)
    controller.Router.GET("/shops/new", controller.newShop)

    以下のエラーが発生する。

    panic: wildcard route ':shop_id' conflicts with existing children in path '/shops/:shop_id'

    github.com/gin-gonic/gin/issues/388に同じハマり方してる人がいる。 直す方法は不明。

    これだと、Railsみたいなルーティングができないね。

    Rails のルーティング | Rails ガイド

    おそらくginというよりHttpRouterのバグか。

    non-wildcard and wildcard router conflict, why? · Issue #210 · julienschmidt/httprouter · GitHub

    gin/tree.goaddRouteを直したい。

    gin/tree.go at develop · gin-gonic/gin · GitHub