-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returns pointer to FileInfo from ReadDir #77
base: master
Are you sure you want to change the base?
Returns pointer to FileInfo from ReadDir #77
Conversation
Since the methods of the interface implementation do not have a pointer receiver shouldn't |
What implementation do you mean exactly? I can see few having pointer receiver. |
https://github.com/studio-b12/gowebdav/blob/master/file.go |
Ok I see. |
Hello, any comments on this topic ? Thanks! |
Hi @ueffel could you please comment on this? Thanks |
Ah, I got my trail of thought again: Returning To align the return types of // Stat returns the file stats for a specified path
func (c *Client) Stat(path string) (os.FileInfo, error) {
- var f *File
+ var f File
parse := func(resp interface{}) error {
r := resp.(*response)
- if p := getProps(r, "200"); p != nil && f == nil {
- f = new(File)
+ if p := getProps(r, "200"); p != nil {
+ f = File{}
f.name = p.Name
f.path = path
f.etag = p.ETag @chripo thoughts? |
I'm think @ueffel is right with the unnecessary level of indirection. |
Yeah, makes sense. |
Thanks for comments, will you make the changes? |
@the-plate feel free to make changes! |
Returns pointer to
os.FileInfo
fromReadDir()
- same as Stat does. This would than ensure compatibility of return types forStat()
andReadDir()
. Now are different.