Hooks: Enable -trimpath compiler flag
The Golang runtime requires the main executable, and plugins have precisely the same dependencies. The dependencies are compared by path embedded in the binaries. By default, Go uses the absolute paths.
It causes the GOPATH directory for compiling the hook to point to the same directory for compiling the main executable. It is problematic when we compile the main Stork binary, but external developers compile a hook. They need to configure their environment exactly the same as us.
The solution is to use the -trimpath
flag for compiling the main binary and plugins. It causes the embedded paths to be relative to the GOPATH directory. It shouldn't be visible to the end-users or have any side effects.