Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
8f37c884
Commit
8f37c884
authored
Aug 22, 2011
by
Tarmigan Casebolt
Committed by
Rob Pike
Aug 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gofix: osopen: fixed=true when changing O_CREAT
R=rsc, r CC=golang-dev
https://golang.org/cl/4921047
parent
07490c0f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
osopen.go
src/cmd/gofix/osopen.go
+1
-0
osopen_test.go
src/cmd/gofix/osopen_test.go
+23
-0
No files found.
src/cmd/gofix/osopen.go
View file @
8f37c884
...
@@ -31,6 +31,7 @@ func osopen(f *ast.File) bool {
...
@@ -31,6 +31,7 @@ func osopen(f *ast.File) bool {
// Rename O_CREAT to O_CREATE.
// Rename O_CREAT to O_CREATE.
if
expr
,
ok
:=
n
.
(
ast
.
Expr
);
ok
&&
isPkgDot
(
expr
,
"os"
,
"O_CREAT"
)
{
if
expr
,
ok
:=
n
.
(
ast
.
Expr
);
ok
&&
isPkgDot
(
expr
,
"os"
,
"O_CREAT"
)
{
expr
.
(
*
ast
.
SelectorExpr
)
.
Sel
.
Name
=
"O_CREATE"
expr
.
(
*
ast
.
SelectorExpr
)
.
Sel
.
Name
=
"O_CREATE"
fixed
=
true
return
return
}
}
...
...
src/cmd/gofix/osopen_test.go
View file @
8f37c884
...
@@ -54,6 +54,29 @@ func f() {
...
@@ -54,6 +54,29 @@ func f() {
os.OpenFile(a, os.O_SURPRISE|os.O_CREATE, 0666)
os.OpenFile(a, os.O_SURPRISE|os.O_CREATE, 0666)
_ = os.O_CREATE
_ = 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
}
`
,
`
,
},
},
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment