forked from github/multus-cni
Revert vendor directory to support old golang (GOPATH mode)
gomodule is still in progress to migrate for now, hence multus team decide to keep vendor directory to support build without gomodule.
This commit is contained in:
committed by
Tomofumi Hayashi
parent
de1c1c78e9
commit
ac21a96804
33
vendor/github.com/modern-go/concurrent/go_below_19.go
generated
vendored
Normal file
33
vendor/github.com/modern-go/concurrent/go_below_19.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
//+build !go1.9
|
||||
|
||||
package concurrent
|
||||
|
||||
import "sync"
|
||||
|
||||
// Map implements a thread safe map for go version below 1.9 using mutex
|
||||
type Map struct {
|
||||
lock sync.RWMutex
|
||||
data map[interface{}]interface{}
|
||||
}
|
||||
|
||||
// NewMap creates a thread safe map
|
||||
func NewMap() *Map {
|
||||
return &Map{
|
||||
data: make(map[interface{}]interface{}, 32),
|
||||
}
|
||||
}
|
||||
|
||||
// Load is same as sync.Map Load
|
||||
func (m *Map) Load(key interface{}) (elem interface{}, found bool) {
|
||||
m.lock.RLock()
|
||||
elem, found = m.data[key]
|
||||
m.lock.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
// Load is same as sync.Map Store
|
||||
func (m *Map) Store(key interface{}, elem interface{}) {
|
||||
m.lock.Lock()
|
||||
m.data[key] = elem
|
||||
m.lock.Unlock()
|
||||
}
|
Reference in New Issue
Block a user