all: upgrade dependencies

Closes #610
This commit is contained in:
Filippo Valsorda
2025-12-07 21:38:44 +01:00
committed by Filippo Valsorda
parent 83bab2ae6a
commit ed44098807
5 changed files with 17 additions and 38 deletions

View File

@@ -99,7 +99,7 @@ func main() {
if len(os.Args) == 1 {
flag.Usage()
exit(1)
os.Exit(1)
}
var (

View File

@@ -16,22 +16,15 @@ import (
)
func TestMain(m *testing.M) {
os.Exit(testscript.RunMain(m, map[string]func() int{
"age": func() (exitCode int) {
testOnlyPanicInsteadOfExit = true
defer func() {
if testOnlyDidExit {
exitCode = recover().(int)
}
}()
testscript.Main(m, map[string]func(){
"age": func() {
testOnlyConfigureScryptIdentity = func(r *age.ScryptRecipient) {
r.SetWorkFactor(10)
}
testOnlyFixedRandomWord = "four"
main()
return 0
},
"age-plugin-test": func() (exitCode int) {
"age-plugin-test": func() {
p, _ := plugin.New("test")
p.HandleRecipient(func(data []byte) (age.Recipient, error) {
return testPlugin{}, nil
@@ -39,9 +32,9 @@ func TestMain(m *testing.M) {
p.HandleIdentity(func(data []byte) (age.Identity, error) {
return testPlugin{}, nil
})
return p.Main()
os.Exit(p.Main())
},
}))
})
}
type testPlugin struct{}

View File

@@ -37,7 +37,7 @@ func printf(format string, v ...interface{}) {
func errorf(format string, v ...interface{}) {
l.Printf("age: error: "+format, v...)
l.Printf("age: report unexpected or unhelpful errors at https://filippo.io/age/report")
exit(1)
os.Exit(1)
}
func warningf(format string, v ...interface{}) {
@@ -50,21 +50,7 @@ func errorWithHint(error string, hints ...string) {
l.Printf("age: hint: %s", hint)
}
l.Printf("age: report unexpected or unhelpful errors at https://filippo.io/age/report")
exit(1)
}
// If testOnlyPanicInsteadOfExit is true, exit will set testOnlyDidExit and
// panic instead of calling os.Exit. This way, the wrapper in TestMain can
// recover the panic and return the exit code only if it was originated in exit.
var testOnlyPanicInsteadOfExit bool
var testOnlyDidExit bool
func exit(code int) {
if testOnlyPanicInsteadOfExit {
testOnlyDidExit = true
panic(code)
}
os.Exit(code)
os.Exit(1)
}
// clearLine clears the current line on the terminal, or opens a new line if