Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit acaf8a1

Browse files
authored
Merge pull request #830 from tealeg/staticcheck
Apply changes suggested by staticcheck
2 parents 3476977 + 0c9b983 commit acaf8a1

22 files changed

+380
-504
lines changed

cell.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -509,22 +509,6 @@ func (c *Cell) GetNumberFormat() string {
509509
return c.NumFmt
510510
}
511511

512-
func (c *Cell) formatToFloat(format string) (string, error) {
513-
f, err := strconv.ParseFloat(c.Value, 64)
514-
if err != nil {
515-
return c.Value, err
516-
}
517-
return fmt.Sprintf(format, f), nil
518-
}
519-
520-
func (c *Cell) formatToInt(format string) (string, error) {
521-
f, err := strconv.ParseFloat(c.Value, 64)
522-
if err != nil {
523-
return c.Value, err
524-
}
525-
return fmt.Sprintf(format, int(f)), nil
526-
}
527-
528512
// getNumberFormat will update the parsedNumFmt struct if it has become out of date, since a cell's NumFmt string is a
529513
// public field that could be edited by clients.
530514
func (c *Cell) getNumberFormat() *parsedNumberFormat {

cell_test.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ func TestCell(t *testing.T) {
629629
smallDate := time.Date(1899, 12, 30, 0, 0, 0, 1000, time.UTC)
630630
smallExcelTime := TimeToExcelTime(smallDate, false)
631631

632-
c.Assert(true, qt.Equals, 0.0 != smallExcelTime)
632+
c.Assert(0.0, qt.Not(qt.Equals), smallExcelTime)
633633
roundTrippedDate := TimeFromExcelTime(smallExcelTime, false)
634634
c.Assert(roundTrippedDate, qt.Equals, smallDate)
635635
})
@@ -933,16 +933,6 @@ func (fvc *formattedValueChecker) Equals(cell Cell, expected string) {
933933
fvc.c.Assert(val, qt.Equals, expected)
934934
}
935935

936-
func cellsFormattedValueEquals(t *testing.T, cell *Cell, expected string) {
937-
val, err := cell.FormattedValue()
938-
if err != nil {
939-
t.Error(err)
940-
}
941-
if val != expected {
942-
t.Errorf("Expected cell.FormattedValue() to be %v, got %v", expected, val)
943-
}
944-
}
945-
946936
func TestCellMerge(t *testing.T) {
947937
c := qt.New(t)
948938
csRunO(c, "MergeAndSave", func(c *qt.C, option FileOption) {
@@ -956,7 +946,7 @@ func TestCellMerge(t *testing.T) {
956946
cell := row.AddCell()
957947
cell.Value = "test"
958948
cell.Merge(1, 0)
959-
path := filepath.Join(c.Mkdir(), "merged.xlsx")
949+
path := filepath.Join(t.TempDir(), "merged.xlsx")
960950
err = f.Save(path)
961951
c.Assert(err, qt.Equals, nil)
962952
})

0 commit comments

Comments
 (0)