mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
convert uses of interface{} to any
Done via:
find . -name "*.go" | xargs sed -i -E 's/interface\{\}/any/g'
PiperOrigin-RevId: 487033228
This commit is contained in:
committed by
gVisor bot
parent
c82b70015d
commit
d8aa09e04c
+10
-10
@@ -107,8 +107,8 @@ type filePayloader interface {
|
||||
|
||||
// clientCall is the client=>server method call on the client side.
|
||||
type clientCall struct {
|
||||
Method string `json:"method"`
|
||||
Arg interface{} `json:"arg"`
|
||||
Method string `json:"method"`
|
||||
Arg any `json:"arg"`
|
||||
}
|
||||
|
||||
// serverCall is the client=>server method call on the server side.
|
||||
@@ -119,9 +119,9 @@ type serverCall struct {
|
||||
|
||||
// callResult is the server=>client method call result.
|
||||
type callResult struct {
|
||||
Success bool `json:"success"`
|
||||
Err string `json:"err"`
|
||||
Result interface{} `json:"result"`
|
||||
Success bool `json:"success"`
|
||||
Err string `json:"err"`
|
||||
Result any `json:"result"`
|
||||
}
|
||||
|
||||
// registeredMethod is method registered with the server.
|
||||
@@ -211,7 +211,7 @@ type Stopper interface {
|
||||
// tolerate any object with non-conforming methods. Any non-confirming methods
|
||||
// will lead to an immediate panic, instead of being skipped or an error.
|
||||
// Panics will also be generated by anonymous objects and duplicate entries.
|
||||
func (s *Server) Register(obj interface{}) {
|
||||
func (s *Server) Register(obj any) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
@@ -522,7 +522,7 @@ func NewClient(socket *unet.Socket) *Client {
|
||||
}
|
||||
|
||||
// marshal sends the given FD and json struct.
|
||||
func marshal(s *unet.Socket, v interface{}, fs []*os.File) error {
|
||||
func marshal(s *unet.Socket, v any, fs []*os.File) error {
|
||||
// Marshal to a buffer.
|
||||
data, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
@@ -570,7 +570,7 @@ func marshal(s *unet.Socket, v interface{}, fs []*os.File) error {
|
||||
}
|
||||
|
||||
// unmarhsal receives an FD (optional) and unmarshals the given struct.
|
||||
func unmarshal(s *unet.Socket, v interface{}) ([]*os.File, error) {
|
||||
func unmarshal(s *unet.Socket, v any) ([]*os.File, error) {
|
||||
// Receive a single byte.
|
||||
r := s.Reader(true)
|
||||
r.EnableFDs(maxFiles)
|
||||
@@ -592,7 +592,7 @@ func unmarshal(s *unet.Socket, v interface{}) ([]*os.File, error) {
|
||||
|
||||
// Read the rest.
|
||||
d := json.NewDecoder(io.MultiReader(bytes.NewBuffer(firstByte), s))
|
||||
// urpc internally decodes / re-encodes the data with interface{} as the
|
||||
// urpc internally decodes / re-encodes the data with any as the
|
||||
// intermediate type. We have to unmarshal integers to json.Number type
|
||||
// instead of the default float type for those intermediate values, such
|
||||
// that when they get re-encoded, their values are not printed out in
|
||||
@@ -613,7 +613,7 @@ func unmarshal(s *unet.Socket, v interface{}) ([]*os.File, error) {
|
||||
}
|
||||
|
||||
// Call calls a function.
|
||||
func (c *Client) Call(method string, arg interface{}, result interface{}) error {
|
||||
func (c *Client) Call(method string, arg any, result any) error {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user