StationA / tilenol

Scalable, multi-backend geo vector tile server
MIT License
22 stars 6 forks source link

[Deps] Migrating away from dep to Go modules (#21) #33

Closed jerluc closed 3 years ago

jerluc commented 3 years ago

Overview

This commit migrates away from the now-unsupported dep dependency management tool to using Go's v1.11+ modules. This should also hopefully simplify dependency management going forward for us, especially by avoiding awkward vendorization commits.

Resolves #21

Go modules

Go modules generally work in a similar fashion to Python's and Node's package/module systems:

One nice thing is that the go mod <CMD> CLI doesn't need to be explicitly invoked for each new dependency, but instead can auto-detect dependencies from the import ( ... ) statements in the source code. So to add a new dependency, all you need to do is import it in your file, and then run go mod tidy to ensure that our go.mod + go.sum files pick up any new dependencies. The same process also applies for removing unused dependencies.

Another note that is probably very obvious from this diff is that with Go modules, we no longer need to vendorize the external dependencies into tilenol's codebase. This should certainly make future dependency change diffs much easier on the reviewer's eyes.

Miscellaneous

One minor note is that we had to bump the version of our YAML parser dependency from v2 to v3, as it looks like there are some issues with v2 in the Go module world. That said, the API looks mostly compatible (aside from a minor change to YAML strictness), so this shouldn't be too concerning.