-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix bugs 2 #116
Fix bugs 2 #116
Conversation
analysis/config/config.go
Outdated
// Get absolute path to config. Other files in config will be relative to where the config is. | ||
pathToConfig := filename | ||
if !path.IsAbs(filename) { | ||
wd, _ := os.Getwd() |
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.
Should probably return the error
@@ -226,7 +227,8 @@ func TestLoadVersionBefore_v0_3_0_Errors(t *testing.T) { | |||
|
|||
func TestLoadWithReports(t *testing.T) { | |||
c := NewDefault() | |||
c.ReportsDir = "example-report" | |||
wd, _ := os.Getwd() | |||
c.ReportsDir = path.Join(wd, "testdata/example-report") |
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 think filepath.Join
is preferred over path.Join
for better OS compatibility: https://pkg.go.dev/path/filepath#Join
analysis/load_program.go
Outdated
// If it's a named target, need to change to project root's directory to properly load the target | ||
err := os.Chdir(cfg.Root()) | ||
if err != nil { | ||
return nil, err |
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.
nit: missing error context
0e34095
to
ff35ba9
Compare
This PR fixes bugs in the code: