1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 23:17:19 +00:00

Replace interface{} with any (#25686)

Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`.

Basically the same [as golang did](2580d0e08d).
This commit is contained in:
silverwind
2023-07-04 20:36:08 +02:00
committed by GitHub
parent 00dbba7f42
commit 88f835192d
233 changed files with 727 additions and 727 deletions

View File

@@ -62,7 +62,7 @@ func (o *VirtualSessionProvider) Read(sid string) (session.RawStore, error) {
if o.provider.Exist(sid) {
return o.provider.Read(sid)
}
kv := make(map[interface{}]interface{})
kv := make(map[any]any)
kv["_old_uid"] = "0"
return NewVirtualStore(o, sid, kv), nil
}
@@ -107,12 +107,12 @@ type VirtualStore struct {
p *VirtualSessionProvider
sid string
lock sync.RWMutex
data map[interface{}]interface{}
data map[any]any
released bool
}
// NewVirtualStore creates and returns a virtual session store.
func NewVirtualStore(p *VirtualSessionProvider, sid string, kv map[interface{}]interface{}) *VirtualStore {
func NewVirtualStore(p *VirtualSessionProvider, sid string, kv map[any]any) *VirtualStore {
return &VirtualStore{
p: p,
sid: sid,
@@ -121,7 +121,7 @@ func NewVirtualStore(p *VirtualSessionProvider, sid string, kv map[interface{}]i
}
// Set sets value to given key in session.
func (s *VirtualStore) Set(key, val interface{}) error {
func (s *VirtualStore) Set(key, val any) error {
s.lock.Lock()
defer s.lock.Unlock()
@@ -130,7 +130,7 @@ func (s *VirtualStore) Set(key, val interface{}) error {
}
// Get gets value by given key in session.
func (s *VirtualStore) Get(key interface{}) interface{} {
func (s *VirtualStore) Get(key any) any {
s.lock.RLock()
defer s.lock.RUnlock()
@@ -138,7 +138,7 @@ func (s *VirtualStore) Get(key interface{}) interface{} {
}
// Delete delete a key from session.
func (s *VirtualStore) Delete(key interface{}) error {
func (s *VirtualStore) Delete(key any) error {
s.lock.Lock()
defer s.lock.Unlock()
@@ -192,6 +192,6 @@ func (s *VirtualStore) Flush() error {
s.lock.Lock()
defer s.lock.Unlock()
s.data = make(map[interface{}]interface{})
s.data = make(map[any]any)
return nil
}