With the WrapAll function now in the generated code we can have only one
exposed function to the truss user. `WrapEndpoints`
Then within this function they pass middlewares they want applied to all
endpoints to `in.WrapAll()`.
This removes our standstill on the names for the previous functions.
As it was, InjectEndpointMiddlewares was called for every endpoint on
the defined service. This is fine so long as you want these middlewares
applied to every single endpoint. This breaks down, though, when your
middleware desires are heterogeneous, like, for example, protecting
some endpoints from free access by enforcing some sort of authentication
and authorization, while allowing other endpoints to be freely
accessible (e.g., login, service status, ping).
This change introduces another function into the endpoint middlewares
template, which takes the entire set of endpoints as defined for the
service and returns another set of endpoints. This way, the programmer
has the flexibility wrap different endpoints differently.
This is how service middlewares work, since the middleware wrapping
function takes a service interface, and returns a service interface, but
we should not force a programmer to use Service middlewares if a
middleware would more appropriately be an endpoint middleware.
Additionally, the naming of the middleware application functions has
been changed from using the verb "inject" to the verb "wrap," which
makes more sense in the context of middlewares, which wrap a deeper
functionality.
In a previous pull vendored tests got committed. This is because our ignore in
vendor.json was comma seperated, not space seperated like govendor expected.
This fixes that and removes the vendored tests.
With Truss as an ever-moving target, it may be useful to know what
version you are running. This change will embed the Git SHA and the
build date into the Truss binary, if Truss is built with the Makefile.
If the SHA or build date are set in the binary, it will be displayed in
the usage message. If no SHA or build date are set, no banner will be
displayed.
Note that the Makefile is not used when fetching with `go get` or
building a fetched source repo with `go install`, so binaries built like
this will not have the SHA and build metadata embedded.