Skip to content

Commit 9f11c50

Browse files
somewordmyitcv
authored andcommittedMar 21, 2019
Typo: Replaced = with space (go-modules-by-example#99)
1 parent abec7a9 commit 9f11c50

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed
 

‎001_go_modules_tour/README.md

+40-16
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ module does not exist:
214214
```
215215
216216
Exclusions only apply to builds of the current module. If the current module
217-
were required by a larger build, the exclusions would not apply.= For example,
217+
were required by a larger build, the exclusions would not apply. For example,
218218
an exclusion in rsc.io/quote's go.mod will not apply to our “hello, world”
219219
build. This policy balances giving the authors of the current module almost
220220
arbitrary control over their own build, without also subjecting them to almost
@@ -332,7 +332,7 @@ Let's write an interesting “hello, world” program. Create a directory outsid
332332
your GOPATH/src tree and change into it:
333333

334334
```
335-
$ cd $HOME
335+
$ cd /home/gopher
336336
$ mkdir hello
337337
$ cd hello
338338
```
@@ -361,10 +361,13 @@ go: creating new go.mod: module github.com/you/hello
361361
$ go build
362362
go: finding rsc.io/quote v1.5.2
363363
go: downloading rsc.io/quote v1.5.2
364+
go: extracting rsc.io/quote v1.5.2
364365
go: finding rsc.io/sampler v1.3.0
365366
go: finding golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
366367
go: downloading rsc.io/sampler v1.3.0
368+
go: extracting rsc.io/sampler v1.3.0
367369
go: downloading golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
370+
go: extracting golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
368371
$ ./hello
369372
Hello, world.
370373
```
@@ -381,6 +384,8 @@ this case, the go build wrote a new go.mod:
381384
$ cat go.mod
382385
module github.com/you/hello
383386
387+
go 1.12
388+
384389
require rsc.io/quote v1.5.2
385390
```
386391

@@ -443,9 +448,12 @@ Let's upgrade golang.org/x/text first:
443448
$ go get golang.org/x/text
444449
go: finding golang.org/x/text v0.3.0
445450
go: downloading golang.org/x/text v0.3.0
451+
go: extracting golang.org/x/text v0.3.0
446452
$ cat go.mod
447453
module github.com/you/hello
448454
455+
go 1.12
456+
449457
require (
450458
golang.org/x/text v0.3.0 // indirect
451459
rsc.io/quote v1.5.2
@@ -469,7 +477,7 @@ created:
469477
```
470478
$ go test github.com/you/hello rsc.io/quote
471479
? github.com/you/hello [no test files]
472-
ok rsc.io/quote 0.002s
480+
ok rsc.io/quote 0.003s
473481
```
474482

475483
In the original go command, the package pattern all meant all packages found in
@@ -497,9 +505,12 @@ Another option is to upgrade all modules needed by the build, using go get -u:
497505
$ go get -u
498506
go: finding rsc.io/sampler v1.99.99
499507
go: downloading rsc.io/sampler v1.99.99
508+
go: extracting rsc.io/sampler v1.99.99
500509
$ cat go.mod
501510
module github.com/you/hello
502511
512+
go 1.12
513+
503514
require (
504515
golang.org/x/text v0.3.0 // indirect
505516
rsc.io/quote v1.5.2
@@ -550,6 +561,8 @@ Then use go get to ask for a specific version, like maybe v1.3.1:
550561
$ cat go.mod
551562
module github.com/you/hello
552563
564+
go 1.12
565+
553566
require (
554567
golang.org/x/text v0.3.0 // indirect
555568
rsc.io/quote v1.5.2
@@ -558,11 +571,14 @@ require (
558571
$ go get rsc.io/sampler@v1.3.1
559572
go: finding rsc.io/sampler v1.3.1
560573
go: downloading rsc.io/sampler v1.3.1
574+
go: extracting rsc.io/sampler v1.3.1
561575
$ go list -m
562576
github.com/you/hello
563577
$ cat go.mod
564578
module github.com/you/hello
565579
580+
go 1.12
581+
566582
require (
567583
golang.org/x/text v0.3.0 // indirect
568584
rsc.io/quote v1.5.2
@@ -583,11 +599,14 @@ go: finding rsc.io/quote v1.5.0
583599
go: finding rsc.io/quote v1.4.0
584600
go: finding rsc.io/sampler v1.0.0
585601
go: downloading rsc.io/sampler v1.2.0
602+
go: extracting rsc.io/sampler v1.2.0
586603
$ go list -m
587604
github.com/you/hello
588605
$ cat go.mod
589606
module github.com/you/hello
590607
608+
go 1.12
609+
591610
require (
592611
golang.org/x/text v0.3.0 // indirect
593612
rsc.io/quote v1.4.0
@@ -610,13 +629,17 @@ github.com/you/hello
610629
$ cat go.mod
611630
module github.com/you/hello
612631
632+
go 1.12
633+
613634
require (
614635
golang.org/x/text v0.3.0 // indirect
615636
rsc.io/quote v1.4.0
616637
)
617638
$ go test github.com/you/hello rsc.io/quote
618639
go: downloading rsc.io/quote v1.4.0
640+
go: extracting rsc.io/quote v1.4.0
619641
go: downloading rsc.io/sampler v1.0.0
642+
go: extracting rsc.io/sampler v1.0.0
620643
? github.com/you/hello [no test files]
621644
ok rsc.io/quote 0.002s
622645
```
@@ -644,6 +667,8 @@ $ echo "** TODO: REMOVE THIS HACK; see https://github.com/golang/go/issues/26454
644667
$ cat go.mod
645668
module github.com/you/hello
646669
670+
go 1.12
671+
647672
require (
648673
golang.org/x/text v0.3.0 // indirect
649674
rsc.io/quote v1.5.2
@@ -659,6 +684,8 @@ github.com/you/hello
659684
$ cat go.mod
660685
module github.com/you/hello
661686
687+
go 1.12
688+
662689
require (
663690
golang.org/x/text v0.3.0 // indirect
664691
rsc.io/quote v1.5.2
@@ -673,7 +700,7 @@ $ quoteVersion=$(go list -m -f "{{.Version}}" rsc.io/quote)
673700
```
674701

675702
Exclusions only apply to builds of the current module. If the current module
676-
were required by a larger build, the exclusions would not apply.= For example,
703+
were required by a larger build, the exclusions would not apply. For example,
677704
an exclusion in rsc.io/quote's go.mod will not apply to our “hello, world”
678705
build. This policy balances giving the authors of the current module almost
679706
arbitrary control over their own build, without also subjecting them to almost
@@ -732,29 +759,26 @@ fork github.com/rsc/quote and then push your change to your fork.
732759

733760
```
734761
$ cd ../quote
735-
$ git remote add $GITHUB_ORG https://github.com/$GITHUB_ORG/quote-fork
762+
$ git remote add go-modules-by-example https://github.com/go-modules-by-example/quote-fork
736763
$ git commit -a -m 'my fork'
737-
[my_quote f8de482] my fork
764+
[my_quote 1ab8a1a] my fork
738765
1 file changed, 1 insertion(+), 1 deletion(-)
739-
$ git push -q $GITHUB_ORG
740-
remote:
741-
remote: Create a pull request for 'my_quote' on GitHub by visiting:
742-
remote: https://github.com/go-modules-by-example/quote-fork/pull/new/my_quote
743-
remote:
766+
$ git push -q go-modules-by-example
744767
$ git tag v0.0.0-myfork
745-
$ git push -q $GITHUB_ORG v0.0.0-myfork
768+
$ git push -q go-modules-by-example v0.0.0-myfork
746769
```
747770

748771
Then you can use that as the replacement:
749772

750773
```
751774
$ cd ../hello
752-
$ go mod edit -replace=rsc.io/quote=github.com/$GITHUB_ORG/quote-fork@v0.0.0-myfork
775+
$ go mod edit -replace=rsc.io/quote=github.com/go-modules-by-example/quote-fork@v0.0.0-myfork
753776
$ go list -m
754777
go: finding github.com/go-modules-by-example/quote-fork v0.0.0-myfork
755778
github.com/you/hello
756779
$ go build
757780
go: downloading github.com/go-modules-by-example/quote-fork v0.0.0-myfork
781+
go: extracting github.com/go-modules-by-example/quote-fork v0.0.0-myfork
758782
$ LANG=fr ./hello
759783
Je peux manger du verre, ça ne me fait pas mal.
760784
```
@@ -781,9 +805,9 @@ see vendor directories:
781805

782806
```
783807
$ go tool nm hello | grep sampler.hello
784-
585de8 D rsc.io/sampler.hello
808+
591d48 D rsc.io/sampler.hello
785809
$ go tool nm vhello | grep sampler.hello
786-
585de8 D rsc.io/sampler.hello
810+
591d48 D rsc.io/sampler.hello
787811
```
788812

789813
Except for this difference, the builds should produce the same binaries. In
@@ -799,7 +823,7 @@ at the start of the title. More posts tomorrow. Thanks, and have fun!
799823
### Version details
800824

801825
```
802-
go version go1.11.1 linux/amd64
826+
go version go1.12 linux/amd64
803827
```
804828

805829
<!-- END -->

0 commit comments

Comments
 (0)
Please sign in to comment.