]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.r60] gofix: osopen: fixed=true when changing O_CREAT
authorAndrew Gerrand <adg@golang.org>
Thu, 8 Sep 2011 00:49:40 +0000 (10:49 +1000)
committerRob Pike <r@golang.org>
Thu, 8 Sep 2011 00:49:40 +0000 (10:49 +1000)
««« CL 4921047 / 15cefddbe963
gofix: osopen: fixed=true when changing O_CREAT

R=rsc, r
CC=golang-dev
https://golang.org/cl/4921047

»»»

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4961071

src/cmd/gofix/osopen.go
src/cmd/gofix/osopen_test.go

index 56147c390e830295e2aec0abed0bd3529ea8bc90..19c19b5b63d38ddaf55c77b0f7791da5378789e7 100644 (file)
@@ -31,6 +31,7 @@ func osopen(f *ast.File) bool {
                // Rename O_CREAT to O_CREATE.
                if expr, ok := n.(ast.Expr); ok && isPkgDot(expr, "os", "O_CREAT") {
                        expr.(*ast.SelectorExpr).Sel.Name = "O_CREATE"
+                       fixed = true
                        return
                }
 
index 43ddd1a40da9b190d7aae2c372ad38a6eb7bc37e..a33bcd4fb48554943cf509334f6f7588e5ec744d 100644 (file)
@@ -54,6 +54,29 @@ func f() {
        os.OpenFile(a, os.O_SURPRISE|os.O_CREATE, 0666)
        _ = os.O_CREATE
 }
+`,
+       },
+       {
+               Name: "osopen.1",
+               In: `package main
+
+import (
+       "os"
+)
+
+func f() {
+       _ = os.O_CREAT
+}
+`,
+               Out: `package main
+
+import (
+       "os"
+)
+
+func f() {
+       _ = os.O_CREATE
+}
 `,
        },
 }