microcluster
microcluster copied to clipboard
Investigate replacement for `GetCallerProject`
microcluster expects some prepared statements to be defined and run on initial start with RegisterStmt. Projects that import microcluster are also expected to have these calls.
In order to determine which statement fits with which project, we attempt to determine the caller package of RegisterStmt
. It is usually one of:
-
/root/parts/{project}/build
when built with snapcraft -
$GOPATH/src/github.com/{account}/{project}
for a local build -
$GOPATH/pkg/mod/github.com/{account}/{project}/{version}
when called from an imported package.
We want to register all statements from the current project and microcluster
, but ignore all other imported projects as we won't have their schema.
Currently, we do this by parsing the project name out of the above paths, and only using microcluster
and the current project. But there may be a cleaner way to handle this.