-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove runtime.Caller
from schema.DotGo
#14705
Conversation
There is no reason to get the calling function. We can expect the filename and package to be passed in. Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Note that we don't need the full file path to the `schema.go` file because we'll have a generate directive inside this directory. Signed-off-by: Mark Laing <mark.laing@canonical.com>
Note that we don't need the full file path to the `schema.go` file because we'll have a generate directive inside this directory. Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah this is nicer. Thanks.
I don't know the history of lxd-generate so dont know why it wasnt done like this originally.
Does this break micro* usage of it though?
Removing the schema sub-command from what? micro* or from lxd-generate? If its removed how will the schema get generated in lxd? |
Who could say!
The
From
You could have a tiny |
I see. Could you have a single freshchema program in say, |
Yeah I don't see why not :) |
Cool, go for it, thanks |
This is an alternative to #14704
I didn't understand why
runtime.Caller
was required. It was because of where theSchemaDotGo
functions were defined in thenode
andcluster
packages.We can instead just split the
go:generate
directives into their respective packages so that invocation there will cause theschema.go
files to be created in the current directory.As an aside, since
lxd-generate
is used bymicro*
packages, I'd also be in favour of removing theschema
subcommand from it, as it only supports generating the LXD node or cluster schemas.