1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2024-11-22 10:25:48 +01:00

Get rid of concurrent map writes, once and for all

This commit is contained in:
Romein van Buren 2023-05-31 19:18:30 +02:00
parent b29502e3cc
commit 27dc1f9117
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
2 changed files with 5 additions and 6 deletions

2
go.mod
View File

@ -53,7 +53,7 @@ require (
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sync v0.1.0
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
)

View File

@ -14,6 +14,7 @@ import (
"github.com/garraflavatra/rolens/internal/ui"
"github.com/ncruces/zenity"
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
"golang.org/x/sync/syncmap"
)
type EnvironmentInfo struct {
@ -32,15 +33,13 @@ type EnvironmentInfo struct {
type App struct {
Env EnvironmentInfo
State map[string]string
State syncmap.Map
ctx context.Context
ui *ui.UI
}
func NewApp() *App {
a := &App{
State: make(map[string]string),
}
a := &App{}
_, err := exec.LookPath("mongodump")
a.Env.HasMongoDump = err == nil
@ -119,6 +118,6 @@ func (a *App) PurgeLogDirectory() {
}
func (a *App) ReportSharedStateVariable(key, value string) {
a.State[key] = value
a.State.Store(key, value)
wailsRuntime.LogDebug(a.ctx, fmt.Sprintf("State: %s=\"%s\"", key, value))
}