remain inside the standard repository. Programs that import packages
that are no longer in the standard repository will need to be edited
by hand.
-<br>
-<font color="red">TODO: go fix should warn about deletions.</font>
</p>
<h3 id="exp">The package tree exp</h3>
Code that uses packages in <code>exp</code> will need to be updated by hand,
or else compiled from an installation that has <code>exp</code> available.
The go fix tool or the compiler will complain about such uses.
-<br>
-<font color="red">TODO: go fix should warn about such uses.</font>
</p>
<h3 id="old">The package tree old</h3>
Code that uses packages now in <code>old</code> will need to be updated by hand,
or else compiled from an installation that has <code>old</code> available.
The go fix tool will warn about such uses.
-<br>
-<font color="red">TODO: go fix should warn about such uses.</font>
</p>
<h3 id="deleted">Deleted packages</h3>
<a href="http://code.google.com/p/go-wiki/wiki/SliceTricks">the Go
Language Community Wiki</a> for some suggestions.
Code that uses the other packages (there should be almost zero) will need to be rethought.
-<br>
-<font color="red">TODO: go fix should warn such uses.</font>
</p>
<h3 id="subrepo">Packages moving to subrepositories</h3>
remain inside the standard repository. Programs that import packages
that are no longer in the standard repository will need to be edited
by hand.
-<br>
-<font color="red">TODO: go fix should warn about deletions.</font>
</p>
<h3 id="exp">The package tree exp</h3>
Code that uses packages in <code>exp</code> will need to be updated by hand,
or else compiled from an installation that has <code>exp</code> available.
The go fix tool or the compiler will complain about such uses.
-<br>
-<font color="red">TODO: go fix should warn about such uses.</font>
</p>
<h3 id="old">The package tree old</h3>
Code that uses packages now in <code>old</code> will need to be updated by hand,
or else compiled from an installation that has <code>old</code> available.
The go fix tool will warn about such uses.
-<br>
-<font color="red">TODO: go fix should warn about such uses.</font>
</p>
<h3 id="deleted">Deleted packages</h3>
<a href="http://code.google.com/p/go-wiki/wiki/SliceTricks">the Go
Language Community Wiki</a> for some suggestions.
Code that uses the other packages (there should be almost zero) will need to be rethought.
-<br>
-<font color="red">TODO: go fix should warn such uses.</font>
</p>
<h3 id="subrepo">Packages moving to subrepositories</h3>
import (
"go/ast"
+ "strings"
)
func init() {
{"net/dict", "code.google.com/p/go.net/dict"},
{"net/websocket", "code.google.com/p/go.net/websocket"},
{"exp/spdy", "code.google.com/p/go.net/spdy"},
+ {"http/spdy", "code.google.com/p/go.net/spdy"},
// go.codereview sub-repository
{"encoding/git85", "code.google.com/p/go.codereview/git85"},
{"patch", "code.google.com/p/go.codereview/patch"},
+
+ // exp
+ {"ebnf", "exp/ebnf"},
+ {"go/types", "exp/types"},
+
+ // deleted
+ {"container/vector", ""},
+ {"exp/datafmt", ""},
+ {"go/typechecker", ""},
+ {"old/netchan", ""},
+ {"old/regexp", ""},
+ {"old/template", ""},
+ {"try", ""},
}
var go1PackageNameRenames = []struct{ newPath, old, new string }{
// First update the imports.
for _, rename := range go1PackageRenames {
- if !imports(f, rename.old) {
+ spec := importSpec(f, rename.old)
+ if spec == nil {
+ continue
+ }
+ if rename.new == "" {
+ warn(spec.Pos(), "package %q has been deleted in Go 1", rename.old)
continue
}
if rewriteImport(f, rename.old, rename.new) {
fixed = true
}
+ if strings.HasPrefix(rename.new, "exp/") {
+ warn(spec.Pos(), "package %q is not part of Go 1", rename.new)
+ }
}
if !fixed {
return false
import "cmath"
import poot "exp/template/html"
+import (
+ "ebnf"
+ "old/regexp"
+)
+
var _ = cmath.Sin
var _ = poot.Poot
`,
import "math/cmplx"
import poot "html/template"
+import (
+ "exp/ebnf"
+ "old/regexp"
+)
+
var _ = cmplx.Sin
var _ = poot.Poot
`,