Repository: fyne-io/fyne
File: storage/uri.go (Go)

Code before:
		listable, err := CanList(v)
		if err != nil {
			return err
		}
		if !listable {
			err = Delete(v)
			if err != nil {
				return err
			}
			continue
		} else {
			err = DeleteRecursive(v)

			if err != nil {
				return err
			}
		}
	}

	err = Delete(u)

	if err != nil {
		return err
	}

	return nil
}

// Reader returns URIReadCloser set up to read from the resource that the
// URI references.
//
// This method can fail in several ways:
//
//   - Different permissions or credentials are required to read the
//     referenced resource.
//
//   - This URI scheme could represent some resources that can be read,
//     but this particular URI references a resources that is not
//     something that can be read.
//
//   - Attempting to set up the reader depended on a lower level
//     operation such as a network or filesystem access that has failed
//     in some way.
//
// Reader is backed by the repository system - this function calls
// into a scheme-specific implementation from a registered repository.
//
// Since: 2.0
func Reader(u fyne.URI) (fyne.URIReadCloser, error) {
	repo, err := repository.ForURI(u)
	if err != nil {

Review comment (suggestion):
No need to check the value and return the same value.
```suggestion
	return Delete(u)
```


Code after:

	return drepo.DeleteAll(u)
}

// Reader returns URIReadCloser set up to read from the resource that the
// URI references.
//
// This method can fail in several ways:
//
//   - Different permissions or credentials are required to read the
//     referenced resource.
//
//   - This URI scheme could represent some resources that can be read,
//     but this particular URI references a resources that is not
//     something that can be read.
//
//   - Attempting to set up the reader depended on a lower level
//     operation such as a network or filesystem access that has failed
//     in some way.
//
// Reader is backed by the repository system - this function calls
// into a scheme-specific implementation from a registered repository.
//
// Since: 2.0
func Reader(u fyne.URI) (fyne.URIReadCloser, error) {
	repo, err := repository.ForURI(u)
	if err != nil {
		return nil, err
	}

	return repo.Reader(u)
}

// CanRead determines if a given URI could be written to using the Reader()
// method. It is preferred to check if a URI is readable using this method
// before calling Reader(), because the underlying operations required to
// attempt to read and then report an error may be slower than the operations
// needed to test if a URI is readable. Keep in mind however that even if
// CanRead returns true, you must still do appropriate error handling for
// Reader(), as the underlying filesystem may have changed since you called
// CanRead.
//
// The non-existence of a resource should not be treated as an error. In other
// words, a Repository implementation which for some URI u returns false, nil
// for Exists(u), CanRead(u) should also return false, nil.
//
// CanRead is backed by the repository system - this function calls into a
// scheme-specific implementation from a registered repository.
//
// Since: 2.0
func CanRead(u fyne.URI) (bool, error) {