-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/gorelease: report a diagnostic error for retracted dependencies
Fixes golang/go#37781 Change-Id: I109ce5da26c757e7e1bdd6bdcee0ff14be35230b Reviewed-on: https://go-review.googlesource.com/c/exp/+/310370 Trust: Jean de Klerk <deklerk@google.com> Run-TryBot: Jean de Klerk <deklerk@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
- Loading branch information
Showing
13 changed files
with
223 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- go.mod -- | ||
module example.com/retract | ||
|
||
go 1.12 | ||
|
||
require example.com/retractdep v1.0.0 | ||
-- go.sum -- | ||
example.com/retractdep v1.0.0 h1:SOVn6jA2ygQY+v8/5aAwxVUJ9teuLrdH/UmbUtp2C44= | ||
example.com/retractdep v1.0.0/go.mod h1:UjjWSH/ulfbAGgQQwm7pAZ988MFRngUSkJnzcuPsYDI= | ||
-- a.go -- | ||
package a | ||
|
||
import _ "example.com/retractdep" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- go.mod -- | ||
module example.com/retractdep | ||
|
||
go 1.12 | ||
-- a.go -- | ||
package a | ||
|
||
const A = "a" |
11 changes: 11 additions & 0 deletions
11
cmd/gorelease/testdata/mod/example.com_retractdep_v1.0.1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- go.mod -- | ||
module example.com/retractdep | ||
|
||
go 1.12 | ||
|
||
// Remote-triggered crash in package foo. See CVE-2021-01234. | ||
retract v1.0.0 | ||
-- a.go -- | ||
package a | ||
|
||
const A = "a" |
12 changes: 12 additions & 0 deletions
12
cmd/gorelease/testdata/mod/example.com_retractdep_v2_v2.0.0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Identical to v1.0.0: just need a new version so that we can test different | ||
# error messages based on the vX.0.1 retraction comments. We can't test them in | ||
# the same major version because go mod will always use the latest version's | ||
# error message. | ||
-- go.mod -- | ||
module example.com/retractdep/v2 | ||
|
||
go 1.12 | ||
-- a.go -- | ||
package a | ||
|
||
const A = "a" |
10 changes: 10 additions & 0 deletions
10
cmd/gorelease/testdata/mod/example.com_retractdep_v2_v2.0.1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- go.mod -- | ||
module example.com/retractdep/v2 | ||
|
||
go 1.12 | ||
|
||
retract v2.0.0 | ||
-- a.go -- | ||
package a | ||
|
||
const A = "a" |
12 changes: 12 additions & 0 deletions
12
cmd/gorelease/testdata/mod/example.com_retractdep_v3_v3.0.0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Identical to v1.0.0: just need a new version so that we can test different | ||
# error messages based on the vX.0.1 retraction comments. We can't test them in | ||
# the same major version because go mod will always use the latest version's | ||
# error message. | ||
-- go.mod -- | ||
module example.com/retractdep/v3 | ||
|
||
go 1.12 | ||
-- a.go -- | ||
package a | ||
|
||
const A = "a" |
11 changes: 11 additions & 0 deletions
11
cmd/gorelease/testdata/mod/example.com_retractdep_v3_v3.0.1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- go.mod -- | ||
module example.com/retractdep/v3 | ||
|
||
go 1.12 | ||
|
||
// This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. This is a very long message. | ||
retract v3.0.0 | ||
-- a.go -- | ||
package a | ||
|
||
const A = "a" |
15 changes: 15 additions & 0 deletions
15
cmd/gorelease/testdata/mod/example.com_retracttransitive_v0.0.1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- go.mod -- | ||
module example.com/retracttransitive | ||
|
||
go 1.12 | ||
|
||
require example.com/retract v0.0.1 | ||
-- go.sum -- | ||
example.com/retract v0.0.1 h1:Afj8efoHilltHZNLlEARzpc1Vkc5d6ugWKIE/YDmXuQ= | ||
example.com/retract v0.0.1/go.mod h1:DUqXjcGF3aJhkjxsUjQ0DG65b51DDBvFrEbcr9kkyto= | ||
example.com/retractdep v1.0.0 h1:SOVn6jA2ygQY+v8/5aAwxVUJ9teuLrdH/UmbUtp2C44= | ||
example.com/retractdep v1.0.0/go.mod h1:UjjWSH/ulfbAGgQQwm7pAZ988MFRngUSkJnzcuPsYDI= | ||
-- a.go -- | ||
package a | ||
|
||
import _ "example.com/retract" |
6 changes: 6 additions & 0 deletions
6
cmd/gorelease/testdata/retract/retract_verify_direct_dep.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mod=example.com/retract | ||
version=v0.0.1 | ||
success=false | ||
-- want -- | ||
Inferred base version: v0.0.1 | ||
required module example.com/retractdep@v1.0.0 retracted by module author: Remote-triggered crash in package foo. See CVE-2021-01234. |
18 changes: 18 additions & 0 deletions
18
cmd/gorelease/testdata/retract/retract_verify_long_msg.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
mod=example.com/retract | ||
success=false | ||
-- want -- | ||
Inferred base version: v0.0.1 | ||
required module example.com/retractdep/v3@v3.0.0 retracted by module author | ||
-- go.mod -- | ||
module example.com/retract | ||
|
||
go 1.12 | ||
|
||
require example.com/retractdep/v3 v3.0.0 | ||
-- go.sum -- | ||
example.com/retractdep/v3 v3.0.0 h1:LEaqsEpt7J4Er+qSPqL7bENpIkRdZdaOE6KaUaiNB5I= | ||
example.com/retractdep/v3 v3.0.0/go.mod h1:B2rEwAWayv3FJ2jyeiq9O3UBbxSvdDqZUtxmKsLyg6k= | ||
-- a.go -- | ||
package a | ||
|
||
import _ "example.com/retractdep/v3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
mod=example.com/retract | ||
success=false | ||
-- want -- | ||
Inferred base version: v0.0.1 | ||
required module example.com/retractdep/v2@v2.0.0 retracted by module author | ||
-- go.mod -- | ||
module example.com/retract | ||
|
||
go 1.12 | ||
|
||
require example.com/retractdep/v2 v2.0.0 | ||
-- go.sum -- | ||
example.com/retractdep/v2 v2.0.0 h1:ehV4yfX3A3jNlRnBmHPxq1TyVs1EhmCYI5miEva6Gv8= | ||
example.com/retractdep/v2 v2.0.0/go.mod h1:rV+p/Yqwnupg15GPVGFRq+un/MYczBZcF1IZ8ubecag= | ||
-- a.go -- | ||
package a | ||
|
||
import _ "example.com/retractdep/v2" |
8 changes: 8 additions & 0 deletions
8
cmd/gorelease/testdata/retract/retract_verify_transitive_dep.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# When a retracted version is transitively depended upon, it should still | ||
# result in a retraction error. | ||
mod=example.com/retracttransitive | ||
version=v0.0.1 | ||
success=false | ||
-- want -- | ||
Inferred base version: v0.0.1 | ||
required module example.com/retractdep@v1.0.0 retracted by module author: Remote-triggered crash in package foo. See CVE-2021-01234. |