| 1 |
go work vendor |
| 2 |
cmp modules.txt.want vendor/modules.txt |
| 3 |
go list example.com/a example.com/b |
| 4 |
|
| 5 |
# Module required in go.mod but not marked explicit in modules.txt |
| 6 |
cp modules.txt.required_but_not_explicit vendor/modules.txt |
| 7 |
! go list example.com/a example.com/b |
| 8 |
cmpenv stderr required_but_not_explicit_error.txt |
| 9 |
|
| 10 |
# Replacement in go.mod but no replacement in modules.txt |
| 11 |
cp modules.txt.missing_replacement vendor/modules.txt |
| 12 |
! go list example.com/a example.com/b |
| 13 |
cmpenv stderr missing_replacement_error.txt |
| 14 |
|
| 15 |
# Replacement in go.mod but different replacement target in modules.txt |
| 16 |
cp modules.txt.different_replacement vendor/modules.txt |
| 17 |
! go list example.com/a example.com/b |
| 18 |
cmpenv stderr different_replacement_error.txt |
| 19 |
|
| 20 |
# Module marked explicit in modules.txt but not required in go.mod |
| 21 |
cp modules.txt.extra_explicit vendor/modules.txt |
| 22 |
! go list example.com/a example.com/b |
| 23 |
cmpenv stderr extra_explicit_error.txt |
| 24 |
|
| 25 |
# Replacement in modules.txt but not in go.mod |
| 26 |
cp modules.txt.extra_replacement vendor/modules.txt |
| 27 |
! go list example.com/a example.com/b |
| 28 |
cmpenv stderr extra_replacement_error.txt |
| 29 |
|
| 30 |
-- modules.txt.want -- |
| 31 |
## workspace |
| 32 |
# example.com/p v1.0.0 => ./p |
| 33 |
## explicit; go 1.21 |
| 34 |
# example.com/q v1.0.0 => ./q |
| 35 |
## explicit; go 1.21 |
| 36 |
-- modules.txt.required_but_not_explicit -- |
| 37 |
## workspace |
| 38 |
# example.com/p v1.0.0 => ./p |
| 39 |
## go 1.21 |
| 40 |
# example.com/q v1.0.0 => ./q |
| 41 |
## explicit; go 1.21 |
| 42 |
-- required_but_not_explicit_error.txt -- |
| 43 |
go: inconsistent vendoring in $GOPATH${/}src: |
| 44 |
example.com/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt |
| 45 |
|
| 46 |
To ignore the vendor directory, use -mod=readonly or -mod=mod. |
| 47 |
To sync the vendor directory, run: |
| 48 |
go work vendor |
| 49 |
-- modules.txt.missing_replacement -- |
| 50 |
## workspace |
| 51 |
# example.com/p v1.0.0 |
| 52 |
## explicit; go 1.21 |
| 53 |
# example.com/q v1.0.0 => ./q |
| 54 |
## explicit; go 1.21 |
| 55 |
-- missing_replacement_error.txt -- |
| 56 |
go: inconsistent vendoring in $GOPATH${/}src: |
| 57 |
example.com/[email protected]: is replaced in a${/}go.mod, but not marked as replaced in vendor/modules.txt |
| 58 |
|
| 59 |
To ignore the vendor directory, use -mod=readonly or -mod=mod. |
| 60 |
To sync the vendor directory, run: |
| 61 |
go work vendor |
| 62 |
-- modules.txt.different_replacement -- |
| 63 |
## workspace |
| 64 |
# example.com/p v1.0.0 => ./r |
| 65 |
## explicit; go 1.21 |
| 66 |
# example.com/q v1.0.0 => ./q |
| 67 |
## explicit; go 1.21 |
| 68 |
-- different_replacement_error.txt -- |
| 69 |
go: inconsistent vendoring in $GOPATH${/}src: |
| 70 |
example.com/[email protected]: is replaced by ../p in a${/}go.mod, but marked as replaced by ./r in vendor/modules.txt |
| 71 |
|
| 72 |
To ignore the vendor directory, use -mod=readonly or -mod=mod. |
| 73 |
To sync the vendor directory, run: |
| 74 |
go work vendor |
| 75 |
-- modules.txt.extra_explicit -- |
| 76 |
## workspace |
| 77 |
# example.com/p v1.0.0 => ./p |
| 78 |
## explicit; go 1.21 |
| 79 |
# example.com/q v1.0.0 => ./q |
| 80 |
## explicit; go 1.21 |
| 81 |
# example.com/r v1.0.0 |
| 82 |
example.com/r |
| 83 |
## explicit; go 1.21 |
| 84 |
-- extra_explicit_error.txt -- |
| 85 |
go: inconsistent vendoring in $GOPATH${/}src: |
| 86 |
example.com/[email protected]: is marked as explicit in vendor/modules.txt, but not explicitly required in a go.mod |
| 87 |
|
| 88 |
To ignore the vendor directory, use -mod=readonly or -mod=mod. |
| 89 |
To sync the vendor directory, run: |
| 90 |
go work vendor |
| 91 |
-- modules.txt.extra_replacement -- |
| 92 |
## workspace |
| 93 |
# example.com/p v1.0.0 => ./p |
| 94 |
## explicit; go 1.21 |
| 95 |
# example.com/q v1.0.0 => ./q |
| 96 |
## explicit; go 1.21 |
| 97 |
# example.com/r v1.0.0 => ./r |
| 98 |
example.com/r |
| 99 |
## go 1.21 |
| 100 |
-- extra_replacement_error.txt -- |
| 101 |
go: inconsistent vendoring in $GOPATH${/}src: |
| 102 |
example.com/[email protected]: is marked as replaced in vendor/modules.txt, but not replaced in the workspace |
| 103 |
|
| 104 |
To ignore the vendor directory, use -mod=readonly or -mod=mod. |
| 105 |
To sync the vendor directory, run: |
| 106 |
go work vendor |
| 107 |
-- go.work -- |
| 108 |
go 1.21 |
| 109 |
|
| 110 |
use ( |
| 111 |
./a |
| 112 |
./b |
| 113 |
) |
| 114 |
-- a/go.mod -- |
| 115 |
module example.com/a |
| 116 |
|
| 117 |
go 1.21 |
| 118 |
|
| 119 |
require example.com/p v1.0.0 |
| 120 |
|
| 121 |
replace example.com/p v1.0.0 => ../p |
| 122 |
-- a/a.go -- |
| 123 |
package p |
| 124 |
-- b/go.mod -- |
| 125 |
module example.com/b |
| 126 |
|
| 127 |
go 1.21 |
| 128 |
|
| 129 |
require example.com/q v1.0.0 |
| 130 |
|
| 131 |
replace example.com/q v1.0.0 => ../q |
| 132 |
-- b/b.go -- |
| 133 |
package b |
| 134 |
-- p/go.mod -- |
| 135 |
module example.com/p |
| 136 |
|
| 137 |
go 1.21 |
| 138 |
-- q/go.mod -- |
| 139 |
module example.com/q |
| 140 |
|
| 141 |
go 1.21 |