Skip to content

Commit c5880d4

Browse files
committed
reformat exporter code
1 parent 48facdd commit c5880d4

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

internal/export/json.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ var _ apis.Exporter = &JSONExporter{}
1313

1414
type JSONExporter struct{}
1515

16+
func NewJSONExporter() *JSONExporter {
17+
return &JSONExporter{}
18+
}
19+
1620
func (c *JSONExporter) Write(plan []apis.Shift, writer io.Writer) error {
1721
if plan == nil {
1822
return errors.New("plan must not be nil")
@@ -30,7 +34,3 @@ func (c *JSONExporter) Write(plan []apis.Shift, writer io.Writer) error {
3034

3135
return nil
3236
}
33-
34-
func NewJSONExporter() *JSONExporter {
35-
return &JSONExporter{}
36-
}

internal/export/table.go

-7
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,19 @@ func (e *TableExporter) Write(plan []apis.Shift, writer io.Writer) error {
4444
func truncate(item reflect.Value) (string, error) {
4545
var maxLen = 15
4646
v := fmt.Sprintf("%v", item.Interface())
47-
if len(v) == maxLen {
48-
return v, nil
49-
}
50-
5147
if len(v) > maxLen {
5248
return v[:12] + "...", nil
5349
}
54-
5550
return v + strings.Repeat(" ", maxLen-len(v)-1), nil
5651
}
5752

5853
func formatDateOnly(item reflect.Value) (string, error) {
5954
if item.Kind() != reflect.Struct {
6055
return "", ErrNotDate
6156
}
62-
6357
t, ok := item.Interface().(time.Time)
6458
if !ok {
6559
return "", ErrNotDate
6660
}
67-
6861
return t.Format(time.DateOnly), nil
6962
}

0 commit comments

Comments
 (0)