Skip to content

Commit f9e6b36

Browse files
committed
a bit of a refactor, match a similar signature to protobuf opaque API
1 parent c244e3d commit f9e6b36

23 files changed

+463
-236
lines changed

client.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ func (cl *Client) Remove(name string) error {
749749

750750
// Both failed: figure out which error to return.
751751

752-
if errF == errD {
752+
if errors.Is(errF, errD) {
753753
// If they are the same error, then just return that.
754754
return wrapPathError("remove", name, errF)
755755
}
@@ -761,8 +761,10 @@ func (cl *Client) Remove(name string) error {
761761
return wrapPathError("remove", name, err)
762762
}
763763

764-
if perm, ok := attrs.GetPermissions(); ok && perm.IsDir() {
765-
return wrapPathError("remove", name, errD)
764+
if attrs.HasPermissions() {
765+
if perm := attrs.GetPermissions(); perm.IsDir() {
766+
return wrapPathError("remove", name, errD)
767+
}
766768
}
767769

768770
return wrapPathError("remove", name, errF)

0 commit comments

Comments
 (0)