Open
Description
Description
I think the sync.Map.Store operation should not propagate the key to the sync.Map, and the same applies to sync.Map.LoadOrStore and sync.Map.Swap. This could lead to situations where keys might propagate into values through the sync.Map.
Modifications may be needed in the ext/sync.model.yml model definition file within the go-all library.
Example Code
package mytest
import (
"fmt"
"net/http"
"sync"
"gorm.io/gorm"
)
var myMap sync.Map
var db gorm.DB
func handler(req *http.Request) {
input := req.URL.Query().Get("input")
value := getData(input)
fmt.Println(value)
}
func process() {
key := "hello"
value := getData(key)
db.Exec(value)
}
func getData(key string) string {
if value, ok := myMap.Load(key); ok {
return value.(string)
}
value := "hello"
myMap.Store(key, value)
return value
}