Skip to content

Commit 542ffc7

Browse files
committed
tools: switch to standard go/types at tip
A few files have been forked and tagged "go1.5,!go1.6" to work around minor API changes between the two types packages: - constant.Value.String() in oracle/describe.go and its tests; - constant.ToInt must now be called before constant.Int64Val. - types.Config{Importer: importer.Default()} in a number of places - go/types/typeutil/import_test.go uses lowercase names to avoid 'import "C"'. Files in go/types/typesutil, missing from my previous CL, have been tagged !go1.5; these files will be deleted in February. All affected packages were tested using 1.4.1, 1.5, and ~1.6 (tip). Change-Id: Iec7fd370e1434508149b378438fb37f65b8d2ba8 Reviewed-on: https://go-review.googlesource.com/18207 Reviewed-by: Robert Griesemer <[email protected]>
1 parent 2477c0d commit 542ffc7

98 files changed

Lines changed: 1860 additions & 185 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎cmd/bundle/main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ import (
4444
"go/format"
4545
"go/parser"
4646
"go/token"
47+
"go/types"
4748
"io"
4849
"log"
4950
"os"
5051
"path/filepath"
5152
"strings"
5253

5354
"golang.org/x/tools/go/loader"
54-
"golang.org/x/tools/go/types"
5555
)
5656

5757
func main() {

‎cmd/ssadump/main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"flag"
1212
"fmt"
1313
"go/build"
14+
"go/types"
1415
"os"
1516
"runtime"
1617
"runtime/pprof"
@@ -20,7 +21,6 @@ import (
2021
"golang.org/x/tools/go/ssa"
2122
"golang.org/x/tools/go/ssa/interp"
2223
"golang.org/x/tools/go/ssa/ssautil"
23-
"golang.org/x/tools/go/types"
2424
)
2525

2626
var (

‎cmd/stringer/stringer.go‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,18 @@ import (
6464
"fmt"
6565
"go/ast"
6666
"go/build"
67+
exact "go/constant"
6768
"go/format"
69+
"go/importer"
6870
"go/parser"
6971
"go/token"
72+
"go/types"
7073
"io/ioutil"
7174
"log"
7275
"os"
7376
"path/filepath"
7477
"sort"
7578
"strings"
76-
77-
"golang.org/x/tools/go/exact"
78-
"golang.org/x/tools/go/types"
79-
80-
_ "golang.org/x/tools/go/gcimporter"
8179
)
8280

8381
var (
@@ -260,7 +258,7 @@ func (g *Generator) parsePackage(directory string, names []string, text interfac
260258
// check type-checks the package. The package must be OK to proceed.
261259
func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) {
262260
pkg.defs = make(map[*ast.Ident]types.Object)
263-
config := types.Config{FakeImportC: true}
261+
config := types.Config{Importer: importer.Default(), FakeImportC: true}
264262
info := &types.Info{
265263
Defs: pkg.defs,
266264
}

‎cmd/vet/copylock.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import (
1111
"fmt"
1212
"go/ast"
1313
"go/token"
14-
15-
"golang.org/x/tools/go/types"
14+
"go/types"
1615
)
1716

1817
func init() {

‎cmd/vet/example.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ package main
66

77
import (
88
"go/ast"
9+
"go/types"
910
"strings"
1011
"unicode"
1112
"unicode/utf8"
12-
13-
"golang.org/x/tools/go/types"
1413
)
1514

1615
func init() {

‎cmd/vet/main.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ import (
1818
"go/parser"
1919
"go/printer"
2020
"go/token"
21+
"go/types"
2122
"io/ioutil"
2223
"os"
2324
"path/filepath"
2425
"strconv"
2526
"strings"
26-
27-
_ "golang.org/x/tools/go/gcimporter"
28-
"golang.org/x/tools/go/types"
2927
)
3028

3129
var (

‎cmd/vet/nilfunc.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ package main
1212
import (
1313
"go/ast"
1414
"go/token"
15-
16-
"golang.org/x/tools/go/types"
15+
"go/types"
1716
)
1817

1918
func init() {

‎cmd/vet/print.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ import (
1010
"bytes"
1111
"flag"
1212
"go/ast"
13+
exact "go/constant"
1314
"go/token"
15+
"go/types"
1416
"strconv"
1517
"strings"
1618
"unicode/utf8"
17-
18-
"golang.org/x/tools/go/exact"
19-
"golang.org/x/tools/go/types"
2019
)
2120

2221
var printfuncs = flag.String("printfuncs", "", "comma-separated list of print function names to check")

‎cmd/vet/shadow.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ import (
3434
"flag"
3535
"go/ast"
3636
"go/token"
37-
38-
"golang.org/x/tools/go/types"
37+
"go/types"
3938
)
4039

4140
var strictShadowing = flag.Bool("shadowstrict", false, "whether to be strict about shadowing; can be noisy")

‎cmd/vet/shift.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ package main
1010

1111
import (
1212
"go/ast"
13+
exact "go/constant"
1314
"go/token"
14-
15-
"golang.org/x/tools/go/exact"
16-
"golang.org/x/tools/go/types"
15+
"go/types"
1716
)
1817

1918
func init() {

0 commit comments

Comments
 (0)