Skip to content

Commit

Permalink
Fix small bug in rendering table (flyteorg#14)
Browse files Browse the repository at this point in the history
- Missing entities are rendered as nil, instead of empty
  • Loading branch information
kumare3 authored and austin362667 committed May 7, 2024
1 parent a244bc7 commit ff326ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flytectl/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func extractRow(data interface{}, columns []Column) []string {

for _, c := range columns {
out, err := jsonpath.Read(data, c.JSONPath)
if err != nil {
if err != nil || out == nil {
out = ""
}
tableData = append(tableData, fmt.Sprintf("%s", out))
Expand Down
3 changes: 2 additions & 1 deletion flytectl/printer/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Inner struct {
Y *time.Time `json:"y"`
}

// TODO Convert this to a Testable Example. For some reason the comparison fails
func TestJSONToTable(t *testing.T) {
d := time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)
j := []struct {
Expand All @@ -34,7 +35,7 @@ func TestJSONToTable(t *testing.T) {
// Output:
// | A | S |
// ------- ----------------------
// | hello | %!s(<nil>) |
// | hello | |
// | hello | 2020-01-01T00:00:00Z |
// | hello | |
// 3 rows
Expand Down

0 comments on commit ff326ef

Please sign in to comment.