-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/fix: add golang.org/x/net/context fix
Fixes #17040 Change-Id: I3682cc0367b919084c280d7dc64746495c1d4aaa Reviewed-on: https://go-review.googlesource.com/28872 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
- Loading branch information
Showing
7 changed files
with
92 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2016 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(contextFix) | ||
} | ||
|
||
var contextFix = fix{ | ||
name: "context", | ||
date: "2016-09-09", | ||
f: ctxfix, | ||
desc: `Change imports of golang.org/x/net/context to context`, | ||
disabled: true, | ||
} | ||
|
||
func ctxfix(f *ast.File) bool { | ||
return rewriteImport(f, "golang.org/x/net/context", "context") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2016 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 | ||
|
||
func init() { | ||
addTestCases(contextTests, ctxfix) | ||
} | ||
|
||
var contextTests = []testCase{ | ||
{ | ||
Name: "context.0", | ||
In: `package main | ||
import "golang.org/x/net/context" | ||
var _ = "golang.org/x/net/context" | ||
`, | ||
Out: `package main | ||
import "context" | ||
var _ = "golang.org/x/net/context" | ||
`, | ||
}, | ||
{ | ||
Name: "context.1", | ||
In: `package main | ||
import ctx "golang.org/x/net/context" | ||
var _ = ctx.Background() | ||
`, | ||
Out: `package main | ||
import ctx "context" | ||
var _ = ctx.Background() | ||
`, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters