aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path/filepath
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-04-04 23:42:14 -0700
committerRob Pike <r@golang.org>2011-04-04 23:42:14 -0700
commit8a90fd3c72e7853a39ba348c0cd278b2d11ea610 (patch)
tree7935e606dcf651b75afd52d337a1c11bff103fea /src/pkg/path/filepath
parent3ebc422ff807a2e7fae96c490ecbc55710adfc42 (diff)
downloadgo-8a90fd3c72e7853a39ba348c0cd278b2d11ea610.tar.xz
os: New Open API.
We replace the current Open with: OpenFile(name, flag, perm) // same as old Open Open(name) // same as old Open(name, O_RDONLY, 0) Create(name) // same as old Open(name, O_RDWR|O_TRUNC|O_CREAT, 0666) This CL includes a gofix module and full code updates: all.bash passes. (There may be a few comments I missed.) The interesting packages are: gofix os Everything else is automatically generated except for hand tweaks to: src/pkg/io/ioutil/ioutil.go src/pkg/io/ioutil/tempfile.go src/pkg/crypto/tls/generate_cert.go src/cmd/goyacc/goyacc.go src/cmd/goyacc/units.y R=golang-dev, bradfitzwork, rsc, r2 CC=golang-dev https://golang.org/cl/4357052
Diffstat (limited to 'src/pkg/path/filepath')
-rw-r--r--src/pkg/path/filepath/match.go2
-rw-r--r--src/pkg/path/filepath/path.go2
-rw-r--r--src/pkg/path/filepath/path_test.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/pkg/path/filepath/match.go b/src/pkg/path/filepath/match.go
index 3b36d18ef7..a05bb5f7e7 100644
--- a/src/pkg/path/filepath/match.go
+++ b/src/pkg/path/filepath/match.go
@@ -263,7 +263,7 @@ func glob(dir, pattern string, matches []string) (m []string, e os.Error) {
if !fi.IsDirectory() {
return
}
- d, err := os.Open(dir, os.O_RDONLY, 0666)
+ d, err := os.Open(dir)
if err != nil {
return
}
diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go
index 4907dac937..de673a7257 100644
--- a/src/pkg/path/filepath/path.go
+++ b/src/pkg/path/filepath/path.go
@@ -280,7 +280,7 @@ func walk(path string, f *os.FileInfo, v Visitor, errors chan<- os.Error) {
// a list of sorted directory entries.
// Copied from io/ioutil to avoid the circular import.
func readDir(dirname string) ([]*os.FileInfo, os.Error) {
- f, err := os.Open(dirname, os.O_RDONLY, 0)
+ f, err := os.Open(dirname)
if err != nil {
return nil, err
}
diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go
index 7ef69461ee..b3b6eb5aba 100644
--- a/src/pkg/path/filepath/path_test.go
+++ b/src/pkg/path/filepath/path_test.go
@@ -249,7 +249,7 @@ func walkTree(n *Node, path string, f func(path string, n *Node)) {
func makeTree(t *testing.T) {
walkTree(tree, tree.name, func(path string, n *Node) {
if n.entries == nil {
- fd, err := os.Open(path, os.O_CREAT, 0660)
+ fd, err := os.Create(path)
if err != nil {
t.Errorf("makeTree: %v", err)
}