Ask questionsx/net/webdav: FileSystem interface should include CopyFile

WebDAV requires support for the COPY method (defined in RFC 2518 section 8.8). Go's WebDAV server implementation in implements it, however the current implementation simply calls FileSystem.OpenFile on the source and destination and uses io.Copy to pipe the content.

While this is fine in some cases, I really think that the user should be able to override / implement this by adding a CopyFile method to the FileSystem interface. Two major reasons I see:

  • The current implementation is inefficient on filesystems that support copy-on-write.
  • The current implementation is inefficient on remote filesystems (effectively, it will pull a file locally and send it back).

Answer questions fstanis

BTW happy to send a PR, just wanted to get an opinion on whether this kind of API change is a good idea first.


Related questions

cmd/link: segmentation fault during mach-o linking hot 6
cmd/vet: potential false positive in the "suspect or" check hot 3
cmd/go: cannot find module providing package error stops `go get` processing hot 3
vendor/ undefined: errors.Frame ... hot 2
cmd/cgo error: runtime: unknown pc 0x7fff5c805b86 hot 2
internal/poll: transparently support new linux io_uring interface hot 2
Plis fixit! Its not good!!! hot 2
cmd/go: needs a better error than "missing dot in first path element" when GOROOT is set incorrectly hot 2
x/mobile: gomobile bind is failing with latest version [+cafc553] of gomobile hot 2
cmd/go: "found, but does not contain package" error refers to replaced version instead of its replacement hot 2
x/xerrors: fails to compile on tip hot 1
cmd/go: `go clean <package>` downloads modules hot 1
runtime: crash with "invalid pc-encoded table" hot 1
cmd/link: showing many ld warnings of "building for macOS, but linking in object file" hot 1
runtime: go program crach, it seems fall into infinite loop hot 1
Github User Rank List