2
0
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:
Miguel Mota 2021-10-01 00:02:31 -07:00 committed by GitHub
parent 9b03adc2bc
commit cfc93c92c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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