| 1 |
go work sync |
| 2 |
|
| 3 |
go list -f '{{.Dir}}' example.com/test |
| 4 |
stdout '^'$PWD${/}test'$' |
| 5 |
|
| 6 |
-- go.work -- |
| 7 |
go 1.18 |
| 8 |
|
| 9 |
use ( |
| 10 |
./test2 |
| 11 |
./test2/sub |
| 12 |
) |
| 13 |
-- test/go.mod -- |
| 14 |
module example.com/test |
| 15 |
|
| 16 |
go 1.18 |
| 17 |
-- test/file.go -- |
| 18 |
package test |
| 19 |
|
| 20 |
func DoSomething() { |
| 21 |
} |
| 22 |
-- test2/go.mod -- |
| 23 |
module example.com/test2 |
| 24 |
|
| 25 |
go 1.18 |
| 26 |
|
| 27 |
replace example.com/test => ../test |
| 28 |
|
| 29 |
require example.com/test v0.0.0-00010101000000-000000000000 |
| 30 |
-- test2/file.go -- |
| 31 |
package test2 |
| 32 |
|
| 33 |
import ( |
| 34 |
"example.com/test" |
| 35 |
) |
| 36 |
|
| 37 |
func DoSomething() { |
| 38 |
test.DoSomething() |
| 39 |
} |
| 40 |
-- test2/sub/go.mod -- |
| 41 |
module example.com/test2/sub |
| 42 |
|
| 43 |
go 1.18 |
| 44 |
|
| 45 |
replace example.com/test => ../../test |
| 46 |
|
| 47 |
require example.com/test v0.0.0 |
| 48 |
-- test2/sub/file.go -- |
| 49 |
package test2 |
| 50 |
|
| 51 |
import ( |
| 52 |
"example.com/test" |
| 53 |
) |
| 54 |
|
| 55 |
func DoSomething() { |
| 56 |
test.DoSomething() |
| 57 |
} |