~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to src/cmd/fix/url2.go

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2011 The Go Authors.  All rights reserved.
2
 
// Use of this source code is governed by a BSD-style
3
 
// license that can be found in the LICENSE file.
4
 
 
5
 
package main
6
 
 
7
 
import "go/ast"
8
 
 
9
 
func init() {
10
 
        register(url2Fix)
11
 
}
12
 
 
13
 
var url2Fix = fix{
14
 
        "url2",
15
 
        "2012-02-16",
16
 
        url2,
17
 
        `Rename some functions in net/url.
18
 
 
19
 
http://codereview.appspot.com/5671061
20
 
`,
21
 
}
22
 
 
23
 
func url2(f *ast.File) bool {
24
 
        if !imports(f, "net/url") {
25
 
                return false
26
 
        }
27
 
 
28
 
        fixed := false
29
 
 
30
 
        walk(f, func(n interface{}) {
31
 
                // Rename functions and methods.
32
 
                sel, ok := n.(*ast.SelectorExpr)
33
 
                if !ok {
34
 
                        return
35
 
                }
36
 
                if !isTopName(sel.X, "url") {
37
 
                        return
38
 
                }
39
 
                if sel.Sel.Name == "ParseWithReference" {
40
 
                        sel.Sel.Name = "ParseWithFragment"
41
 
                        fixed = true
42
 
                }
43
 
        })
44
 
 
45
 
        return fixed
46
 
}