diff options
Diffstat (limited to 'src/cmd/fix/url2.go')
-rw-r--r-- | src/cmd/fix/url2.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/cmd/fix/url2.go b/src/cmd/fix/url2.go new file mode 100644 index 000000000..5fd05ad2a --- /dev/null +++ b/src/cmd/fix/url2.go @@ -0,0 +1,46 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "go/ast" + +func init() { + register(url2Fix) +} + +var url2Fix = fix{ + "url2", + "2012-02-16", + url2, + `Rename some functions in net/url. + +http://codereview.appspot.com/5671061 +`, +} + +func url2(f *ast.File) bool { + if !imports(f, "net/url") { + return false + } + + fixed := false + + walk(f, func(n interface{}) { + // Rename functions and methods. + sel, ok := n.(*ast.SelectorExpr) + if !ok { + return + } + if !isTopName(sel.X, "url") { + return + } + if sel.Sel.Name == "ParseWithReference" { + sel.Sel.Name = "ParseWithFragment" + fixed = true + } + }) + + return fixed +} |