File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ You have a local package `sample.com/math` that does not exist in a remote repo
52
52
that you would like to import into your ` school ` project. How can we accomplish
53
53
this?
54
54
55
+ #### Solution
55
56
First you must initialize the modules of each project:
56
57
```
57
58
# in the math dir
@@ -76,7 +77,8 @@ The projects should both contain `go.mod` files:
76
77
```
77
78
78
79
Next, we need to manually update the ` school ` project's ` go.mod ` file using the
79
- [ replace directive] ( https://golang.org/ref/mod#go-mod-file-replace )
80
+ [ replace directive] ( https://golang.org/ref/mod#go-mod-file-replace ) and a
81
+ relative path:
80
82
```
81
83
module school
82
84
@@ -99,7 +101,7 @@ The final step is to run [go mod tidy](https://golang.org/ref/mod#go-mod-tidy) w
99
101
go: found sample.com/math in sample.com/math v0.0.0-00010101000000-000000000000
100
102
```
101
103
102
- Finally, we can successfully import the local package:
104
+ Finally, we can successfully import the local package and run :
103
105
```
104
106
~/code/go/module-test/school $ go run main.go
105
107
6
You can’t perform that action at this time.
0 commit comments