aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_edit.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/testdata/script/mod_edit.txt')
-rw-r--r--src/cmd/go/testdata/script/mod_edit.txt114
1 files changed, 100 insertions, 14 deletions
diff --git a/src/cmd/go/testdata/script/mod_edit.txt b/src/cmd/go/testdata/script/mod_edit.txt
index 898d8524ac..78485eb86a 100644
--- a/src/cmd/go/testdata/script/mod_edit.txt
+++ b/src/cmd/go/testdata/script/mod_edit.txt
@@ -16,15 +16,19 @@ cmpenv go.mod $WORK/go.mod.init
cmpenv go.mod $WORK/go.mod.init
# go mod edits
-go mod edit -droprequire=x.1 -require=x.1@v1.0.0 -require=x.2@v1.1.0 -droprequire=x.2 -exclude='x.1 @ v1.2.0' -exclude=x.1@v1.2.1 -replace=x.1@v1.3.0=y.1@v1.4.0 -replace='x.1@v1.4.0 = ../z'
+go mod edit -droprequire=x.1 -require=x.1@v1.0.0 -require=x.2@v1.1.0 -droprequire=x.2 -exclude='x.1 @ v1.2.0' -exclude=x.1@v1.2.1 -replace=x.1@v1.3.0=y.1@v1.4.0 -replace='x.1@v1.4.0 = ../z' -retract=v1.6.0 -retract=[v1.1.0,v1.2.0] -retract=[v1.3.0,v1.4.0] -retract=v1.0.0
cmpenv go.mod $WORK/go.mod.edit1
-go mod edit -droprequire=x.1 -dropexclude=x.1@v1.2.1 -dropreplace=x.1@v1.3.0 -require=x.3@v1.99.0
+go mod edit -droprequire=x.1 -dropexclude=x.1@v1.2.1 -dropreplace=x.1@v1.3.0 -require=x.3@v1.99.0 -dropretract=v1.0.0 -dropretract=[v1.1.0,v1.2.0]
cmpenv go.mod $WORK/go.mod.edit2
# go mod edit -json
go mod edit -json
cmpenv stdout $WORK/go.mod.json
+# go mod edit -json (retractions with rationales)
+go mod edit -json $WORK/go.mod.retractrationale
+cmp stdout $WORK/go.mod.retractrationale.json
+
# go mod edit -json (empty mod file)
go mod edit -json $WORK/go.mod.empty
cmp stdout $WORK/go.mod.empty.json
@@ -40,11 +44,11 @@ cmpenv go.mod $WORK/go.mod.edit5
# go mod edit -fmt
cp $WORK/go.mod.badfmt go.mod
go mod edit -fmt -print # -print should avoid writing file
-cmpenv stdout $WORK/go.mod.edit6
+cmpenv stdout $WORK/go.mod.goodfmt
cmp go.mod $WORK/go.mod.badfmt
go mod edit -fmt # without -print, should write file (and nothing to stdout)
! stdout .
-cmpenv go.mod $WORK/go.mod.edit6
+cmpenv go.mod $WORK/go.mod.goodfmt
# go mod edit -module
cd $WORK/m
@@ -84,6 +88,13 @@ replace (
x.1 v1.3.0 => y.1 v1.4.0
x.1 v1.4.0 => ../z
)
+
+retract (
+ v1.6.0
+ [v1.3.0, v1.4.0]
+ [v1.1.0, v1.2.0]
+ v1.0.0
+)
-- $WORK/go.mod.edit2 --
module x.x/y/z
@@ -93,6 +104,11 @@ exclude x.1 v1.2.0
replace x.1 v1.4.0 => ../z
+retract (
+ v1.6.0
+ [v1.3.0, v1.4.0]
+)
+
require x.3 v1.99.0
-- $WORK/go.mod.json --
{
@@ -122,6 +138,16 @@ require x.3 v1.99.0
"Path": "../z"
}
}
+ ],
+ "Retract": [
+ {
+ "Low": "v1.6.0",
+ "High": "v1.6.0"
+ },
+ {
+ "Low": "v1.3.0",
+ "High": "v1.4.0"
+ }
]
}
-- $WORK/go.mod.edit3 --
@@ -136,6 +162,11 @@ replace (
x.1 v1.4.0 => y.1/v2 v2.3.5
)
+retract (
+ v1.6.0
+ [v1.3.0, v1.4.0]
+)
+
require x.3 v1.99.0
-- $WORK/go.mod.edit4 --
module x.x/y/z
@@ -146,6 +177,11 @@ exclude x.1 v1.2.0
replace x.1 => y.1/v2 v2.3.6
+retract (
+ v1.6.0
+ [v1.3.0, v1.4.0]
+)
+
require x.3 v1.99.0
-- $WORK/go.mod.edit5 --
module x.x/y/z
@@ -154,15 +190,10 @@ go $goversion
exclude x.1 v1.2.0
-require x.3 v1.99.0
--- $WORK/go.mod.edit6 --
-module x.x/y/z
-
-go 1.10
-
-exclude x.1 v1.2.0
-
-replace x.1 => y.1/v2 v2.3.6
+retract (
+ v1.6.0
+ [v1.3.0, v1.4.0]
+)
require x.3 v1.99.0
-- $WORK/local/go.mod.edit --
@@ -183,10 +214,64 @@ exclude x.1 v1.2.0
replace x.1 => y.1/v2 v2.3.6
require x.3 v1.99.0
+
+retract [ "v1.8.1" , "v1.8.2" ]
+-- $WORK/go.mod.goodfmt --
+module x.x/y/z
+
+go 1.10
+
+exclude x.1 v1.2.0
+
+replace x.1 => y.1/v2 v2.3.6
+
+require x.3 v1.99.0
+
+retract [v1.8.1, v1.8.2]
-- $WORK/m/go.mod.edit --
module x.x/y/z
go $goversion
+-- $WORK/go.mod.retractrationale --
+module x.x/y/z
+
+go 1.15
+
+// a
+retract v1.0.0
+
+// b
+retract (
+ v1.0.1
+ v1.0.2 // c
+)
+-- $WORK/go.mod.retractrationale.json --
+{
+ "Module": {
+ "Path": "x.x/y/z"
+ },
+ "Go": "1.15",
+ "Require": null,
+ "Exclude": null,
+ "Replace": null,
+ "Retract": [
+ {
+ "Low": "v1.0.0",
+ "High": "v1.0.0",
+ "Rationale": "a"
+ },
+ {
+ "Low": "v1.0.1",
+ "High": "v1.0.1",
+ "Rationale": "b"
+ },
+ {
+ "Low": "v1.0.2",
+ "High": "v1.0.2",
+ "Rationale": "c"
+ }
+ ]
+}
-- $WORK/go.mod.empty --
-- $WORK/go.mod.empty.json --
{
@@ -195,5 +280,6 @@ go $goversion
},
"Require": null,
"Exclude": null,
- "Replace": null
+ "Replace": null,
+ "Retract": null
}