-
Notifications
You must be signed in to change notification settings - Fork 111
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
RSDK-9721: Improve firstRun error message for missing meta.json. #4726
base: main
Are you sure you want to change the base?
Conversation
// | ||
// .viam/packages/data/module/e76d1b3b-0468-4efd-bb7f-fb1d2b352fcb-viamrtsp-0_1_0-linux-amd64/ | ||
// .viam/packages/data/module/e76d1b3b-0468-4efd-bb7f-fb1d2b352fcb-viamrtsp-0_1_0-linux-amd64/bin/ | ||
// .viam/packages/data/module/e76d1b3b-0468-4efd-bb7f-fb1d2b352fcb-viamrtsp-0_1_0-linux-amd64/bin.first_run_succeeded |
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.
I don't think this was intentional. Or maybe it was. But it's certainly a bit odd to concatenate a "directory" with a "file suffix" without some "file prefix".
I started to "fix" this by using filepath.Join
. And additionally being "backwards compatible" by checking for both bin.first_run_succeeded
as well as bin/.first_run_succeeded
.
In the end I figured it's not worth risking breaking this code for aesthetics. But found it useful to document a concrete example such that readers aren't left wondering if something is wrong.
@@ -272,7 +276,7 @@ func (m *Module) FirstRun( | |||
var pathErr *os.PathError | |||
switch { | |||
case errors.As(err, &pathErr): | |||
logger.Debugw("meta.json not found, skipping first run", "error", err) | |||
logger.Infow("meta.json does not exist, skipping first run") |
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.
I waffled on whether this case should also be writing out a "first run succeeded" file. I opted not to -- just in case we ever had a bug with getJSONManifest
incorrectly missing a file that it should be seeing.
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.
was wrapping errors how we failed this check?
@@ -15,7 +15,6 @@ import ( | |||
"sync" | |||
"time" | |||
|
|||
"github.com/pkg/errors" |
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.
The stacks are coming from my favorite library. I haven't 100% verified I used the corollary methods in "stderrors" properly. Particularly the Join/As/Is. I'm leaning on unit tests making the appropriate assertions.
"reflect" | ||
"regexp" | ||
"strings" | ||
|
||
"github.com/pkg/errors" |
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.
My "find definition" jumping while looking at module.go
brought me here
No description provided.