mirror of
https://github.com/miguelmota/cointop
synced 2024-11-05 00:00:14 +00:00
fix: ClearSyncMap pass by reference (#195)
This commit is contained in:
parent
9b03adc2bc
commit
cfc93c92c6
@ -67,8 +67,8 @@ func (ct *Cointop) GetCoinsTable() *table.Table {
|
||||
if ct.IsFavoritesVisible() {
|
||||
headers = ct.GetFavoritesTableHeaders()
|
||||
}
|
||||
ct.ClearSyncMap(ct.State.tableColumnWidths)
|
||||
ct.ClearSyncMap(ct.State.tableColumnAlignLeft)
|
||||
ct.ClearSyncMap(&ct.State.tableColumnWidths)
|
||||
ct.ClearSyncMap(&ct.State.tableColumnAlignLeft)
|
||||
for _, coin := range ct.State.coins {
|
||||
if coin == nil {
|
||||
continue
|
||||
|
@ -78,8 +78,8 @@ func (ct *Cointop) GetPortfolioTable() *table.Table {
|
||||
t := table.NewTable().SetWidth(maxX)
|
||||
var rows [][]*table.RowCell
|
||||
headers := ct.GetPortfolioTableHeaders()
|
||||
ct.ClearSyncMap(ct.State.tableColumnWidths)
|
||||
ct.ClearSyncMap(ct.State.tableColumnAlignLeft)
|
||||
ct.ClearSyncMap(&ct.State.tableColumnWidths)
|
||||
ct.ClearSyncMap(&ct.State.tableColumnAlignLeft)
|
||||
for _, coin := range ct.State.coins {
|
||||
leftMargin := 1
|
||||
rightMargin := 1
|
||||
|
@ -48,8 +48,8 @@ func (ct *Cointop) GetPriceAlertsTable() *table.Table {
|
||||
t := table.NewTable().SetWidth(maxX)
|
||||
var rows [][]*table.RowCell
|
||||
headers := ct.GetPriceAlertsTableHeaders()
|
||||
ct.ClearSyncMap(ct.State.tableColumnWidths)
|
||||
ct.ClearSyncMap(ct.State.tableColumnAlignLeft)
|
||||
ct.ClearSyncMap(&ct.State.tableColumnWidths)
|
||||
ct.ClearSyncMap(&ct.State.tableColumnAlignLeft)
|
||||
for _, entry := range ct.State.priceAlerts.Entries {
|
||||
if entry.Expired {
|
||||
continue
|
||||
|
@ -46,7 +46,7 @@ func TruncateString(value string, maxLen int) string {
|
||||
}
|
||||
|
||||
// ClearSyncMap clears a sync.Map
|
||||
func (ct *Cointop) ClearSyncMap(syncMap sync.Map) {
|
||||
func (ct *Cointop) ClearSyncMap(syncMap *sync.Map) {
|
||||
syncMap.Range(func(key interface{}, value interface{}) bool {
|
||||
syncMap.Delete(key)
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user