You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributing.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ If you don't feel confident to submit your own guide, submitting an issue for so
28
28
* Thinking of examples that showcase what you're trying to teach without confusing the reader with other features is important.
29
29
* For example you can learn about `struct`s without understanding pointers.
30
30
* Brevity is king.
31
-
* Follow the [Code Review Comments style guide](https://github.com/golang/go/wiki/CodeReviewComments). It's important for a consistent style across all the sections.
31
+
* Follow the [Code Review Comments style guide](https://go.dev/wiki/CodeReviewComments). It's important for a consistent style across all the sections.
32
32
* Your section should have a runnable application at the end \(e.g `package main` with a `main` func\) so users can see it in action and play with it.
Copy file name to clipboardExpand all lines: install-go.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@ The official installation instructions for Go are available [here](https://golan
5
5
## Go Environment
6
6
7
7
### Go Modules
8
-
Go 1.11 introduced [Modules](https://github.com/golang/go/wiki/Modules). This approach is the default build mode since Go 1.16, therefore the use of `GOPATH` is not recommended.
8
+
9
+
Go 1.11 introduced [Modules](https://go.dev/wiki/Modules). This approach is the default build mode since Go 1.16, therefore the use of `GOPATH` is not recommended.
9
10
10
11
Modules aim to solve problems related to dependency management, version selection and reproducible builds; they also enable users to run Go code outside of `GOPATH`.
Copy file name to clipboardExpand all lines: integers.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
Integers work as you would expect. Let's write an `Add` function to try things out. Create a test file called `adder_test.go` and write this code.
6
6
7
-
**Note:** Go source files can only have one `package` per directory. Make sure that your files are organised into their own packages. [Here is a good explanation on this.](https://dave.cheney.net/2014/12/01/five-suggestions-for-setting-up-a-go-project)
7
+
**Note:** Go source files can only have one `package` per directory. Make sure that your files are organised into their own packages. [Here is a good explanation on this.](https://dave.cheney.net/2014/12/01/five-suggestions-for-setting-up-a-go-project)
8
8
9
9
Your project directory might look something like this:
10
10
@@ -13,7 +13,7 @@ learnGoWithTests
13
13
|
14
14
|-> helloworld
15
15
| |- hello.go
16
-
| |- hello_test.go
16
+
| |- hello_test.go
17
17
|
18
18
|-> integers
19
19
| |- adder_test.go
@@ -69,7 +69,7 @@ Now run the tests and we should be happy that the test is correctly reporting wh
69
69
70
70
`adder_test.go:10: expected '4' but got '0'`
71
71
72
-
If you have noticed we learnt about _named return value_ in the [last](hello-world.md#one...last...refactor?) section but aren't using the same here. It should generally be used when the meaning of the result isn't clear from context, in our case it's pretty much clear that `Add` function will add the parameters. You can refer [this](https://github.com/golang/go/wiki/CodeReviewComments#named-result-parameters) wiki for more details.
72
+
If you have noticed we learnt about _named return value_ in the [last](hello-world.md#one...last...refactor?) section but aren't using the same here. It should generally be used when the meaning of the result isn't clear from context, in our case it's pretty much clear that `Add` function will add the parameters. You can refer [this](https://go.dev/wiki/CodeReviewComments#named-result-parameters) wiki for more details.
73
73
74
74
## Write enough code to make it pass
75
75
@@ -85,7 +85,7 @@ Ah hah! Foiled again, TDD is a sham right?
85
85
86
86
We could write another test, with some different numbers to force that test to fail but that feels like [a game of cat and mouse](https://en.m.wikipedia.org/wiki/Cat_and_mouse).
87
87
88
-
Once we're more familiar with Go's syntax I will introduce a technique called *"Property Based Testing"*, which would stop annoying developers and help you find bugs.
88
+
Once we're more familiar with Go's syntax I will introduce a technique called _"Property Based Testing"_, which would stop annoying developers and help you find bugs.
89
89
90
90
For now, let's fix it properly
91
91
@@ -162,7 +162,7 @@ If you publish your code with examples to a public URL, you can share the docume
162
162
163
163
What we have covered:
164
164
165
-
* More practice of the TDD workflow
166
-
* Integers, addition
167
-
* Writing better documentation so users of our code can understand its usage quickly
168
-
* Examples of how to use our code, which are checked as part of our tests
165
+
*More practice of the TDD workflow
166
+
*Integers, addition
167
+
*Writing better documentation so users of our code can understand its usage quickly
168
+
*Examples of how to use our code, which are checked as part of our tests
Copy file name to clipboardExpand all lines: structs-methods-and-interfaces.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -392,7 +392,7 @@ This kind of approach of using interfaces to declare **only what you need** is v
392
392
393
393
Now that you have some understanding of structs we can introduce "table driven tests".
394
394
395
-
[Table driven tests](https://github.com/golang/go/wiki/TableDrivenTests) are useful when you want to build a list of test cases that can be tested in the same manner.
395
+
[Table driven tests](https://go.dev/wiki/TableDrivenTests) are useful when you want to build a list of test cases that can be tested in the same manner.
Copy file name to clipboardExpand all lines: sync.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -255,7 +255,7 @@ We've covered a few things from the [sync package](https://golang.org/pkg/sync/)
255
255
### When to use locks over channels and goroutines?
256
256
257
257
[We've previously covered goroutines in the first concurrency chapter](concurrency.md) which let us write safe concurrent code so why would you use locks?
258
-
[The go wiki has a page dedicated to this topic; Mutex Or Channel](https://github.com/golang/go/wiki/MutexOrChannel)
258
+
[The go wiki has a page dedicated to this topic; Mutex Or Channel](https://go.dev/wiki/MutexOrChannel)
259
259
260
260
> A common Go newbie mistake is to over-use channels and goroutines just because it's possible, and/or because it's fun. Don't be afraid to use a sync.Mutex if that fits your problem best. Go is pragmatic in letting you use the tools that solve your problem best and not forcing you into one style of code.
0 commit comments