all: run "go fix"

This commit is contained in:
Filippo Valsorda
2025-12-25 20:48:28 +01:00
parent ec92694aad
commit abe371e157
12 changed files with 16 additions and 25 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ func main() {
// l is a logger with no prefixes.
var l = log.New(os.Stderr, "", 0)
func errorf(format string, v ...interface{}) {
func errorf(format string, v ...any) {
l.Printf("age-inspect: error: "+format, v...)
l.Printf("age-inspect: report unexpected or unhelpful errors at https://filippo.io/age/report")
os.Exit(1)
+1 -1
View File
@@ -170,7 +170,7 @@ func convert(in io.Reader, out io.Writer) {
}
}
func errorf(format string, v ...interface{}) {
func errorf(format string, v ...any) {
log.Printf("age-keygen: error: "+format, v...)
log.Fatalf("age-keygen: report unexpected or unhelpful errors at https://filippo.io/age/report")
}
+3 -6
View File
@@ -156,11 +156,8 @@ func main() {
safe := true
unsafeShell := regexp.MustCompile(`[^\w@%+=:,./-]`)
for _, arg := range os.Args {
if unsafeShell.MatchString(arg) {
safe = false
break
}
if slices.ContainsFunc(os.Args, unsafeShell.MatchString) {
safe = false
}
if safe {
i := len(os.Args) - flag.NArg()
@@ -316,7 +313,7 @@ func passphrasePromptForEncryption() (string, error) {
p := string(pass)
if p == "" {
var words []string
for i := 0; i < 10; i++ {
for range 10 {
words = append(words, randomWord())
}
p = strings.Join(words, "-")
+4 -4
View File
@@ -30,17 +30,17 @@ import (
// l is a logger with no prefixes.
var l = log.New(os.Stderr, "", 0)
func printf(format string, v ...interface{}) {
func printf(format string, v ...any) {
l.Printf("age: "+format, v...)
}
func errorf(format string, v ...interface{}) {
func errorf(format string, v ...any) {
l.Printf("age: error: "+format, v...)
l.Printf("age: report unexpected or unhelpful errors at https://filippo.io/age/report")
os.Exit(1)
}
func warningf(format string, v ...interface{}) {
func warningf(format string, v ...any) {
l.Printf("age: warning: "+format, v...)
}
@@ -53,7 +53,7 @@ func errorWithHint(error string, hints ...string) {
os.Exit(1)
}
func printfToTerminal(format string, v ...interface{}) error {
func printfToTerminal(format string, v ...any) error {
return term.WithTerminal(func(_, out *os.File) error {
_, err := fmt.Fprintf(out, "age: "+format+"\n", v...)
return err