-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using the gin framework and dep #304
Comments
hi, sorry to hear that, we hoped that using build tags would make things easier. The -tags flag has nothing to do with git. As you can see here it means that the gin router will then be included but not the other ones. The error you have normally means you have outdated dependencies. Please try a clean gopath or update (go get -u -a). Maybe this issue also helps: #292 Edit: Apparently build flags are currently not possible with dep golang/dep#291 but in the meantime you can still use the old variant for api2go which means installing api2go normally, and installing the matching adapter https://github.com/manyminds/api2go-adapter/tree/master/gingonic |
Hi @sharpner, thanks for the reply. Knowing its a build tag has helped me get a bit further. Support for dep sounds like a separate issue now, so I created a new branch in my example repo where I stripped out all the dep files. This helped me learn two things:
I still want to use dep though. The lack of build tag support can be worked around by explicitly adding gin as a dependency. Gopkg.toml
I now encounter an error similar to the one in #292 go build -tags=gingonic
# github.com/LewisWatson/api2go-with-gin-example/vendor/github.com/manyminds/api2go/routing
vendor/github.com/manyminds/api2go/routing/httprouter.go:51:26: cannot use notAllowedHandler (type http.Handler) as type http.HandlerFunc in assignment: need type assertion Pinning httprouter package to master didn't fix the error for me, unfortunatley. There is hope that this is the last problem. As described in this comment, changing line 51 of I've updated the master branch of github.com/LewisWatson/api2go-with-gin-example to contain what I have so far (minus the vendor hack) Finally, here is the full output of PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
github.com/gedex/inflector * branch master 16278e9 16278e9 1
github.com/gin-contrib/sse * branch master 22d885f 22d885f 1
github.com/gin-gonic/gin ^1.2.0 v1.2 d459835 d459835 3
github.com/golang/protobuf * branch master 1643683 1643683 1
github.com/gorilla/context * v1.1 1ea2538 1ea2538 1
github.com/gorilla/mux * v1.6.0 7f08801 7f08801 1
github.com/julienschmidt/httprouter branch master v1.1 8c199fb e1b9828 1
github.com/labstack/echo * 3.2.3 cec7629 b28538b 1
github.com/labstack/gommon * 0.2.3 57409ad 57409ad 2
github.com/manyminds/api2go ^1.0.0-RC4 1.0-RC4 e7b6938 e7b6938 6
github.com/mattn/go-colorable * v0.0.9 167de6b 167de6b 1
github.com/mattn/go-isatty * v0.0.3 0360b2a 0360b2a 1
github.com/ugorji/go * branch master 00a57e0 427fecf 1
github.com/valyala/bytebufferpool * branch master e746df9 e746df9 1
github.com/valyala/fasttemplate * branch master dcecefd dcecefd 1
golang.org/x/crypto * branch master 687d4b8 6a293f2 2
golang.org/x/sys * branch master 75813c6 1e2299c 1
gopkg.in/go-playground/validator.v8 * v8.18.2 5f1438d 5f1438d 1
gopkg.in/yaml.v2 * branch v2 eb3733d eb3733d 1 |
Thanks for your thorough investigation! For the httprouter it seams you still have v1.1 which is a version from 2015. I think the master pinning did not work as you expected. You can see this because REVISION and LATEST do not match. I linked this issue in httprouter as well, to further push the tagging of a new release ;) |
Switching the This is how my [[constraint]]
name = "github.com/manyminds/api2go"
version = "1.0-RC4"
[[constraint]]
name = "github.com/gin-gonic/gin"
version = "1.2"
[[override]]
name = "github.com/julienschmidt/httprouter"
branch = "master"
|
Thank you for posting your solution! |
Hello, I'm having some trouble getting api2go working with gin.
I followed the instructions on the main readme but I get the following error:
I suspect that
go get -tags=gingonic github.com/manyminds/api2go
might not be working. I haven't encountered the-tags
flag before, but does it not look for a "gingionic" tag in git? If so then that tag doesn't exist. I also plan to use go-dep, and I'm not sure how the-tags
flag translates to agoPkg.toml
file.Example code available at https://github.com/LewisWatson/api2go-with-gin-example
Full build log available at https://travis-ci.org/LewisWatson/api2go-with-gin-example/jobs/298967492
Regards
Lewis
edit: fix typo
The text was updated successfully, but these errors were encountered: