Skip to content

Commit

Permalink
use reflect.DeepEqual in case interface is implemented by a slice
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott committed Dec 25, 2023
1 parent 828ed72 commit c33eb6b
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions nfs_onrename.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"os"
"reflect"

"github.com/go-git/go-billy/v5"
"github.com/willscott/go-nfs-client/nfs/xdr"
Expand Down Expand Up @@ -31,18 +32,8 @@ func onRename(ctx context.Context, w *response, userHandle Handler) error {
if err != nil {
return &NFSStatusError{NFSStatusStale, err}
}
// check 2 fs are 'same'
fr1, err := fs.Stat("/")
if err != nil {
return &NFSStatusError{NFSStatusNotSupp, os.ErrPermission}

}
fr2, err := fs2.Stat("/")
if err != nil {
return &NFSStatusError{NFSStatusNotSupp, os.ErrPermission}
}

if fr1 != fr2 {
// check the two fs are the same
if !reflect.DeepEqual(fs, fs2) {
return &NFSStatusError{NFSStatusNotSupp, os.ErrPermission}
}

Expand Down

0 comments on commit c33eb6b

Please sign in to comment.