Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

utils/fs: add OpenFile method to filesystem interface. #104

Merged
merged 3 commits into from
Oct 31, 2016
Merged

utils/fs: add OpenFile method to filesystem interface. #104

merged 3 commits into from
Oct 31, 2016

Conversation

smola
Copy link
Collaborator

@smola smola commented Oct 31, 2016

  • added OpenFile to fs.Filesystem interface.
  • added OpenFile implementation to 'os' filesystem.
  • bring back BaseFile.

* added OpenFile to fs.Filesystem interface.
* added OpenFile implementation to 'os' filesystem.
* bring back BaseFile.
@@ -21,7 +21,8 @@ func NewOS(baseDir string) *OS {
}
}

// Create creates a new GlusterFSFile
// Create creates a file and opens it with standard permissions
// and modes O_RDWR, O_CREATE and O_TRUNC.
func (fs *OS) Create(filename string) (File, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid duplicate code you can call fs.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666), and the same for Open

@@ -38,3 +37,16 @@ type File interface {
}

type FileInfo os.FileInfo

type BaseFile struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I though that we are adding this to the bare package not to the OS one

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed wildcard import.

@mcuadros mcuadros merged commit 15fef29 into src-d:master Oct 31, 2016
mcuadros pushed a commit that referenced this pull request Jan 31, 2017
* utils/fs: add OpenFile method to filesystem interface.

* added OpenFile to fs.Filesystem interface.
* added OpenFile implementation to 'os' filesystem.
* bring back BaseFile.

* utils/fs/os: do not use wildcard import.

* utils/fs/os: implement Open and Create using OpenFile.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants