Closed shreyas-goenka closed 2 months ago
Just FYI, gopatch used to get refactor and get to a starting point for more custom changes. There's something satisfying about writing patch files:
@@
var t expression
@@
diag.Diagnostic{
...,
- Locations: t,
+ Locations: []dyn.Location{t},
...,
}
@@
@@
diag.Diagnostics{
{
...,
- Locations: dyn.Location{...},
+ Locations: []dyn.Location{{...}},
},
}
@@
@@
package python
-assert.Equal(t, dyn.Location{...}, diags[0].Locations)
+assert.Equal(t, []dyn.Location{{...}}, diags[0].Locations)
@@
@@
-b.Config.GetLocation("experimental.use_legacy_run_as")
+b.Config.GetLocations("experimental.use_legacy_run_as")
@@
var x identifier
@@
package validate
diag.Diagnostic{
...,
- Locations: []dyn.Location{x.Location()},
+ Locations: x.Locations(),
...,
}
@@
@@
-[]dyn.Location{dyn.Location{...}}
+[]dyn.Location{{...}}
Integration tests have been triggered, just in case.
Also addressing the applicable comments in https://github.com/databricks/cli/pull/1616
Changes
This PR changes
diag.Diagnostics
to allow including multiple locations associated with the diagnostic message. The diagnostics that now return multiple locations with this PR are:Tests
Existing unit tests pass. New unit test case to assert on error message when multiple locations are included.
Example output: