vardius / gorouter

Go Server/API micro framework, HTTP request router, multiplexer, mux
https://rafallorenz.com/gorouter
MIT License
154 stars 17 forks source link

Incompatible tag in go.mod #11

Closed alexedwards closed 5 years ago

alexedwards commented 5 years ago

When pulling through github.com/vardius/gorouter as a dependency, my go.mod file has the +incompatible tag:

module example.com

go 1.12

require github.com/vardius/gorouter v3.0.7-0.20190205101248-eab65e0a6301+incompatible

I think this is because the gorouter repository isn't following the module path conventions for v2+ repositories.

vardius commented 5 years ago

Isn't it the fact that there is no go.mod file in this repository ?

I simply did not create it because this router has no dependencies, and I did not want to include in go.mod file packages I used for benchmarks. (not an issue anymore)

I think releasing major version v4.0.0 with a go.mod file should fix issue. Do you agree @alexedwards ?

alexedwards commented 5 years ago

Kind of!

I beleive that the +incompatible tag isn't just because there's no go.mod file. Lot's of repositories don't have them, but will still pull through without the incompatible tag... so long as they are in v0 or v1. For example: https://github.com/bmizerany/pat.

My understanding is that the incompatible tag is appearing because Go knows that the gorouter repository is at v3.0.6, but the import path doesn't follow the convention of being github.com/vardius/gorouter/v3.

So if you're making a v4 release, then I think that initializing the go.mod file with go mod init github.com/vardius/gorouter/v4 should fix it.

I should have said in my first message, you've done really nice work on this package. I really like the design decisions you've made for the router and the documentation is excellent! : )

vardius commented 5 years ago

I created new release https://github.com/vardius/gorouter/releases/tag/v4.0.0,

which seems to work correctly now https://github.com/vardius/go-api-boilerplate/blob/05ee7ccd28718b542ec67665e768e2a2a35666ef/go.mod#L15

Since now import router as import "github.com/vardius/gorouter/v4". Please update your imports.

alexedwards commented 5 years ago

That works great now. Thanks for the fast fix :+1: