Skip to content

Commit 09c3a5e

Browse files
committed
README.md: update package paths to be golang.org/x/example/...
The module name is golang.org/x/example and the canonical repo is go.googlesource.com/example. Add the pkg.go.dev link in the main README.md and remove stale godoc.org links. Change-Id: Ia67be2179885d144c97284237df1f4373717722d Reviewed-on: https://go-review.googlesource.com/c/example/+/307689 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Suzy Mueller <[email protected]>
1 parent bcf50bf commit 09c3a5e

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Go example projects
22

3+
4+
[![Go Reference](https://pkg.go.dev/badge/golang.org/x/example.svg)](https://pkg.go.dev/golang.org/x/example)
5+
36
This repository contains a collection of Go programs and libraries that
47
demonstrate the language, standard libraries, and tools.
58

6-
## The examples
7-
8-
### [hello](hello/) ([godoc](//godoc.org/github.com/golang/example/hello)) and [stringutil](stringutil/) ([godoc](//godoc.org/github.com/golang/example/stringutil))
9+
## [hello](hello/) and [stringutil](stringutil/)
910

10-
go get github.com/golang/example/hello
11+
go get golang.org/x/example/hello
1112

1213
A trivial "Hello, world" program that uses a stringutil package.
1314

@@ -23,9 +24,9 @@ Library [stringutil](stringutil/) covers:
2324
* Conversion between string and []rune
2425
* Table-driven unit tests ([testing](//golang.org/pkg/testing/))
2526

26-
### [outyet](outyet/) ([godoc](//godoc.org/github.com/golang/example/outyet))
27+
## [outyet](outyet/)
2728

28-
go get github.com/golang/example/outyet
29+
go get golang.org/x/example/outyet
2930

3031
A web server that answers the question: "Is Go 1.x out yet?"
3132

@@ -42,24 +43,24 @@ Topics covered:
4243
* Dependency injection
4344
* Time ([time](//golang.org/pkg/time/))
4445

45-
### [appengine-hello](appengine-hello/) ([godoc](//godoc.org/github.com/golang/example/appengine-hello))
46+
## [appengine-hello](appengine-hello/)
4647

47-
goapp get github.com/golang/example/appengine-hello
48+
goapp get golang.org/x/example/appengine-hello
4849

4950
A trivial "Hello, world" App Engine application intended to be used as the
5051
starting point for your own code.
5152

5253
_Note_: The `goapp` tool is part of the [Google App Engine SDK for Go](https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go).
5354

54-
### [gotypes](gotypes/) ([godoc](//godoc.org/github.com/golang/example/gotypes))
55+
## [gotypes](gotypes/)
5556

5657
The `go/types` package is a type-checker for Go programs. It is one of the most
5758
complex packages in Go's standard library, so we have provided this tutorial to
5859
help you find your bearings. It comes with several example programs that you
5960
can obtain using `go get` and play with as you learn to build tools that analyze
6061
or manipulate Go programs.
6162

62-
### [template](template/) ([godoc](//godoc.org/github.com/golang/example/template))
63+
## [template](template/)
6364

6465
A trivial web server that demonstrates the use of the
6566
[`template` package](https://golang.org/pkg/text/template/)'s `block` feature.

gotypes/README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ constant expressions, as we'll see in
7878

7979

8080

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)
8282
from the `x/tools` repository is a client of the type
8383
checker that loads, parses, and type-checks a complete Go program from
8484
source code.
@@ -133,10 +133,10 @@ the _hello, world_ program, supplied as a string.
133133
Later examples will be variations on this one, and we'll often omit
134134
boilerplate details such as parsing.
135135
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/...`.
137137

138138

139-
// go get github.com/golang/example/gotypes/pkginfo
139+
// go get golang.org/x/example/gotypes/pkginfo
140140

141141
```
142142
package main
@@ -243,7 +243,7 @@ Finally, the program prints the attributes of the package, shown below.
243243

244244

245245
```
246-
$ go build github.com/golang/example/gotypes/pkginfo
246+
$ go build golang.org/x/example/gotypes/pkginfo
247247
$ ./pkginfo
248248
Package "cmd/hello"
249249
Name: main
@@ -492,7 +492,7 @@ The function below prints the location of each referring and defining
492492
identifier in the input program, and the object it refers to.
493493

494494

495-
// go get github.com/golang/example/gotypes/defsuses
495+
// go get golang.org/x/example/gotypes/defsuses
496496

497497
```
498498
func PrintDefsUses(fset *token.FileSet, files ...*ast.File) error {
@@ -522,7 +522,7 @@ func PrintDefsUses(fset *token.FileSet, files ...*ast.File) error {
522522
Let's use the _hello, world_ program again as the input:
523523

524524

525-
// go get github.com/golang/example/gotypes/hello
525+
// go get golang.org/x/example/gotypes/hello
526526

527527
```
528528
package main
@@ -539,7 +539,7 @@ This is what it prints:
539539

540540

541541
```
542-
$ go build github.com/golang/example/gotypes/defsuses
542+
$ go build golang.org/x/example/gotypes/defsuses
543543
$ ./defsuses
544544
hello.go:1:9: "main" defines <nil>
545545
hello.go:5:6: "main" defines func hello.main()
@@ -783,7 +783,7 @@ Observe that the `ParseComments` flag directs the parser to
783783
preserve comments in the input.
784784

785785

786-
// go get github.com/golang/example/gotypes/lookup
786+
// go get golang.org/x/example/gotypes/lookup
787787

788788
```
789789
func main() {
@@ -853,7 +853,7 @@ Here's the output:
853853

854854

855855
```
856-
$ go build github.com/golang/example/gotypes/lookup
856+
$ go build golang.org/x/example/gotypes/lookup
857857
$ ./lookup
858858
At hello.go:6:1, "append" = builtin append
859859
At hello.go:8:9, "fmt" = package fmt
@@ -1467,7 +1467,7 @@ The statement below inspects every expression within the AST of a single
14671467
type-checked file and prints its type, value, and mode:
14681468

14691469

1470-
// go get github.com/golang/example/gotypes/typeandvalue
1470+
// go get golang.org/x/example/gotypes/typeandvalue
14711471

14721472
```
14731473
// f is a parsed, type-checked *ast.File.
@@ -1517,7 +1517,7 @@ the program prints:
15171517

15181518

15191519
```
1520-
$ go build github.com/golang/example/gotypes/typeandvalue
1520+
$ go build golang.org/x/example/gotypes/typeandvalue
15211521
$ ./typeandvalue
15221522
make(map[string]int) mode: value
15231523
type: map[string]int
@@ -1573,7 +1573,7 @@ call `x.f()` was intended;
15731573
comparing a method `x.f` against nil is a common mistake.
15741574

15751575

1576-
// go get github.com/golang/example/gotypes/nilfunc
1576+
// go get golang.org/x/example/gotypes/nilfunc
15771577

15781578
```
15791579
// CheckNilFuncComparison reports unintended comparisons
@@ -1640,7 +1640,7 @@ the program reports these errors:
16401640

16411641

16421642
```
1643-
$ go build github.com/golang/example/gotypes/nilfunc
1643+
$ go build golang.org/x/example/gotypes/nilfunc
16441644
$ ./nilfunc
16451645
input.go:7:5: comparison of function Bytes == nil is always false
16461646
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
18941894
calls `PrintSkeleton` with the remaining two arguments:
18951895

18961896

1897-
// go get github.com/golang/example/gotypes/skeleton
1897+
// go get golang.org/x/example/gotypes/skeleton
18981898

18991899
```
19001900
func PrintSkeleton(pkg *types.Package, ifacename, concname string) error {
@@ -1968,7 +1968,7 @@ The following program inspects all pairs of package-level named types
19681968
in `pkg`, and reports the types that satisfy each interface type.
19691969

19701970

1971-
// go get github.com/golang/example/gotypes/implements
1971+
// go get golang.org/x/example/gotypes/implements
19721972

19731973
```
19741974
// Find all named types at package level.
@@ -2000,7 +2000,7 @@ for _, T := range allNamed {
20002000
Given this input,
20012001

20022002

2003-
// go get github.com/golang/example/gotypes/implements
2003+
// go get golang.org/x/example/gotypes/implements
20042004

20052005
```
20062006
const input = `package main
@@ -2022,7 +2022,7 @@ the program prints:
20222022

20232023

20242024
```
2025-
$ go build github.com/golang/example/gotypes/implements
2025+
$ go build golang.org/x/example/gotypes/implements
20262026
$ ./implements
20272027
*hello.A satisfies hello.I
20282028
hello.B satisfies hello.I
@@ -2177,7 +2177,7 @@ Such a tool could help identify inefficient parameter passing in your
21772177
programs.
21782178

21792179

2180-
// go get github.com/golang/example/gotypes/hugeparam
2180+
// go get golang.org/x/example/gotypes/hugeparam
21812181

21822182
```
21832183
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
23362336
program starting from the single package, `pkgpath`:
23372337

23382338

2339-
// go get github.com/golang/example/gotypes/doc
2339+
// go get golang.org/x/example/gotypes/doc
23402340

23412341
```
23422342
pkgpath, name := os.Args[1], os.Args[2]
@@ -2362,7 +2362,7 @@ Notice that we instructed the parser to retain comments during parsing.
23622362
The rest of the program prints the output:
23632363

23642364

2365-
// go get github.com/golang/example/gotypes/doc
2365+
// go get golang.org/x/example/gotypes/doc
23662366

23672367
```
23682368
// Print the object and its methods (incl. location of definition).

gotypes/weave.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func main() {
7777

7878
// Show caption unless '-' follows.
7979
if len(words) < 4 || words[3] != "-" {
80-
fmt.Printf(" // go get github.com/golang/example/gotypes/%s\n\n",
80+
fmt.Printf(" // go get golang.org/x/example/gotypes/%s\n\n",
8181
filepath.Dir(filename))
8282
}
8383

0 commit comments

Comments
 (0)