Skip to content

Commit 30c4e8a

Browse files
author
xiao
committed
update module7.go with dummy command; add task 1 and 2
1 parent 4e2dd27 commit 30c4e8a

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

module7/module7.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package module7
22

3-
//go:generate goimports -w module7_code.go
3+
//go:generate echo "command and arguments"

task/module7.md

+22-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,33 @@ To test this module locally:
99
* Run command `go test -run Module7` to run all tests for module 7, or
1010
* Run command `go test -v -run Module7` to run all tests for module 7 with verbose information
1111

12-
## Task 1
12+
## Task 1: Get help for `go generate`
13+
The command to get more information on `go generate` is `go help generate`
1314

15+
In a nutshell, `go generate` scans the files for lines like the following (called `directive`), and execute those commands:
16+
```
17+
//go:generate command <argument...>
18+
```
1419

20+
Note that `go generate` must be run explicitly.
21+
22+
23+
## Task 2: Fill in the directive
24+
First, check the content of the provided `module7.go` file.
25+
26+
Then, in the terminal, run `go generate` and examine the output.
27+
Note that the `echo` command is executed.
28+
29+
Third, check the content of the provided `module7_code.go` file.
30+
Note the `fmt` and `runtime` packages are missing.
31+
32+
Your task is to fill in the directive to import the missing packages.
33+
You need to replace the whole `echo "command and arguments"` part with proper command.
34+
35+
## Task 3
1536

16-
## Task 2
1737

1838

1939

2040
## Extra help
21-
Here is the command to get more information on `go generate`:
22-
- `go help generate`
2341

0 commit comments

Comments
 (0)