@@ -78,7 +78,7 @@ constant expressions, as we'll see in
78
78
79
79
80
80
81
- The [ ` golang.org/x/tools/go/loader ` package] ( https://godoc.org /golang.org/x/tools/go/loader )
81
+ The [ ` golang.org/x/tools/go/loader ` package] ( https://pkg.go.dev /golang.org/x/tools/go/loader )
82
82
from the ` x/tools ` repository is a client of the type
83
83
checker that loads, parses, and type-checks a complete Go program from
84
84
source code.
@@ -133,10 +133,10 @@ the _hello, world_ program, supplied as a string.
133
133
Later examples will be variations on this one, and we'll often omit
134
134
boilerplate details such as parsing.
135
135
To check out and build the examples,
136
- run ` go get github.com/golang /example/gotypes/... ` .
136
+ run ` go get golang.org/x /example/gotypes/... ` .
137
137
138
138
139
- // go get github.com/golang /example/gotypes/pkginfo
139
+ // go get golang.org/x /example/gotypes/pkginfo
140
140
141
141
```
142
142
package main
@@ -243,7 +243,7 @@ Finally, the program prints the attributes of the package, shown below.
243
243
244
244
245
245
```
246
- $ go build github.com/golang /example/gotypes/pkginfo
246
+ $ go build golang.org/x /example/gotypes/pkginfo
247
247
$ ./pkginfo
248
248
Package "cmd/hello"
249
249
Name: main
@@ -492,7 +492,7 @@ The function below prints the location of each referring and defining
492
492
identifier in the input program, and the object it refers to.
493
493
494
494
495
- // go get github.com/golang /example/gotypes/defsuses
495
+ // go get golang.org/x /example/gotypes/defsuses
496
496
497
497
```
498
498
func PrintDefsUses(fset *token.FileSet, files ...*ast.File) error {
@@ -522,7 +522,7 @@ func PrintDefsUses(fset *token.FileSet, files ...*ast.File) error {
522
522
Let's use the _ hello, world_ program again as the input:
523
523
524
524
525
- // go get github.com/golang /example/gotypes/hello
525
+ // go get golang.org/x /example/gotypes/hello
526
526
527
527
```
528
528
package main
@@ -539,7 +539,7 @@ This is what it prints:
539
539
540
540
541
541
```
542
- $ go build github.com/golang /example/gotypes/defsuses
542
+ $ go build golang.org/x /example/gotypes/defsuses
543
543
$ ./defsuses
544
544
hello.go:1:9: "main" defines <nil>
545
545
hello.go:5:6: "main" defines func hello.main()
@@ -783,7 +783,7 @@ Observe that the `ParseComments` flag directs the parser to
783
783
preserve comments in the input.
784
784
785
785
786
- // go get github.com/golang /example/gotypes/lookup
786
+ // go get golang.org/x /example/gotypes/lookup
787
787
788
788
```
789
789
func main() {
@@ -853,7 +853,7 @@ Here's the output:
853
853
854
854
855
855
```
856
- $ go build github.com/golang /example/gotypes/lookup
856
+ $ go build golang.org/x /example/gotypes/lookup
857
857
$ ./lookup
858
858
At hello.go:6:1, "append" = builtin append
859
859
At hello.go:8:9, "fmt" = package fmt
@@ -1467,7 +1467,7 @@ The statement below inspects every expression within the AST of a single
1467
1467
type-checked file and prints its type, value, and mode:
1468
1468
1469
1469
1470
- // go get github.com/golang /example/gotypes/typeandvalue
1470
+ // go get golang.org/x /example/gotypes/typeandvalue
1471
1471
1472
1472
```
1473
1473
// f is a parsed, type-checked *ast.File.
@@ -1517,7 +1517,7 @@ the program prints:
1517
1517
1518
1518
1519
1519
```
1520
- $ go build github.com/golang /example/gotypes/typeandvalue
1520
+ $ go build golang.org/x /example/gotypes/typeandvalue
1521
1521
$ ./typeandvalue
1522
1522
make(map[string]int) mode: value
1523
1523
type: map[string]int
@@ -1573,7 +1573,7 @@ call `x.f()` was intended;
1573
1573
comparing a method ` x.f ` against nil is a common mistake.
1574
1574
1575
1575
1576
- // go get github.com/golang /example/gotypes/nilfunc
1576
+ // go get golang.org/x /example/gotypes/nilfunc
1577
1577
1578
1578
```
1579
1579
// CheckNilFuncComparison reports unintended comparisons
@@ -1640,7 +1640,7 @@ the program reports these errors:
1640
1640
1641
1641
1642
1642
```
1643
- $ go build github.com/golang /example/gotypes/nilfunc
1643
+ $ go build golang.org/x /example/gotypes/nilfunc
1644
1644
$ ./nilfunc
1645
1645
input.go:7:5: comparison of function Bytes == nil is always false
1646
1646
input.go:7:25: comparison of function Repeat != nil is always true
@@ -1894,7 +1894,7 @@ The `main` function (not shown) loads the specified package and
1894
1894
calls ` PrintSkeleton ` with the remaining two arguments:
1895
1895
1896
1896
1897
- // go get github.com/golang /example/gotypes/skeleton
1897
+ // go get golang.org/x /example/gotypes/skeleton
1898
1898
1899
1899
```
1900
1900
func PrintSkeleton(pkg *types.Package, ifacename, concname string) error {
@@ -1968,7 +1968,7 @@ The following program inspects all pairs of package-level named types
1968
1968
in ` pkg ` , and reports the types that satisfy each interface type.
1969
1969
1970
1970
1971
- // go get github.com/golang /example/gotypes/implements
1971
+ // go get golang.org/x /example/gotypes/implements
1972
1972
1973
1973
```
1974
1974
// Find all named types at package level.
@@ -2000,7 +2000,7 @@ for _, T := range allNamed {
2000
2000
Given this input,
2001
2001
2002
2002
2003
- // go get github.com/golang /example/gotypes/implements
2003
+ // go get golang.org/x /example/gotypes/implements
2004
2004
2005
2005
```
2006
2006
const input = `package main
@@ -2022,7 +2022,7 @@ the program prints:
2022
2022
2023
2023
2024
2024
```
2025
- $ go build github.com/golang /example/gotypes/implements
2025
+ $ go build golang.org/x /example/gotypes/implements
2026
2026
$ ./implements
2027
2027
*hello.A satisfies hello.I
2028
2028
hello.B satisfies hello.I
@@ -2177,7 +2177,7 @@ Such a tool could help identify inefficient parameter passing in your
2177
2177
programs.
2178
2178
2179
2179
2180
- // go get github.com/golang /example/gotypes/hugeparam
2180
+ // go get golang.org/x /example/gotypes/hugeparam
2181
2181
2182
2182
```
2183
2183
var bytesFlag = flag.Int("bytes", 48, "maximum parameter size in bytes")
@@ -2336,7 +2336,7 @@ Here's the first part of the program, showing how to load an entire
2336
2336
program starting from the single package, ` pkgpath ` :
2337
2337
2338
2338
2339
- // go get github.com/golang /example/gotypes/doc
2339
+ // go get golang.org/x /example/gotypes/doc
2340
2340
2341
2341
```
2342
2342
pkgpath, name := os.Args[1], os.Args[2]
@@ -2362,7 +2362,7 @@ Notice that we instructed the parser to retain comments during parsing.
2362
2362
The rest of the program prints the output:
2363
2363
2364
2364
2365
- // go get github.com/golang /example/gotypes/doc
2365
+ // go get golang.org/x /example/gotypes/doc
2366
2366
2367
2367
```
2368
2368
// Print the object and its methods (incl. location of definition).
0 commit comments