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