mirror of
https://github.com/FiloSottile/age.git
synced 2026-01-09 05:13:07 +00:00
all: run "go fix"
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package armor_test
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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, "-")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -138,7 +138,7 @@ func convert(in io.Reader, out io.Writer) {
|
||||
}
|
||||
}
|
||||
|
||||
func errorf(format string, v ...interface{}) {
|
||||
func errorf(format string, v ...any) {
|
||||
log.Printf("age-plugin-pq: error: "+format, v...)
|
||||
log.Fatalf("age-plugin-pq: report unexpected or unhelpful errors at https://filippo.io/age/report")
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func polymod(values []byte) uint32 {
|
||||
top := chk >> 25
|
||||
chk = (chk & 0x1ffffff) << 5
|
||||
chk = chk ^ uint32(v)
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := range 5 {
|
||||
bit := top >> i & 1
|
||||
if bit == 1 {
|
||||
chk ^= generator[i]
|
||||
|
||||
@@ -77,10 +77,7 @@ func (w *WrappedBase64Encoder) writeWrapped(p []byte) (int, error) {
|
||||
panic("age: internal error: non-empty WrappedBase64Encoder.buf")
|
||||
}
|
||||
for len(p) > 0 {
|
||||
toWrite := ColumnsPerLine - (w.written % ColumnsPerLine)
|
||||
if toWrite > len(p) {
|
||||
toWrite = len(p)
|
||||
}
|
||||
toWrite := min(ColumnsPerLine-(w.written%ColumnsPerLine), len(p))
|
||||
n, _ := w.buf.Write(p[:toWrite])
|
||||
w.written += n
|
||||
p = p[n:]
|
||||
@@ -228,7 +225,7 @@ func (e *ParseError) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
func errorf(format string, a ...interface{}) error {
|
||||
func errorf(format string, a ...any) error {
|
||||
return &ParseError{fmt.Errorf(format, a...)}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package format_test
|
||||
|
||||
|
||||
@@ -566,13 +566,13 @@ func (p *Plugin) Confirm(prompt, yes, no string) (choseYes bool, err error) {
|
||||
|
||||
// fatalInteractf prints the error to stderr and sets the broken flag, so the
|
||||
// Wrap/Unwrap caller can exit with an error.
|
||||
func (p *Plugin) fatalInteractf(format string, args ...interface{}) error {
|
||||
func (p *Plugin) fatalInteractf(format string, args ...any) error {
|
||||
p.broken = true
|
||||
fmt.Fprintf(p.stderr, format, args...)
|
||||
return fmt.Errorf(format, args...)
|
||||
}
|
||||
|
||||
func (p *Plugin) fatalf(format string, args ...interface{}) int {
|
||||
func (p *Plugin) fatalf(format string, args ...any) int {
|
||||
fmt.Fprintf(p.stderr, format, args...)
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// The terminal is reached directly through /dev/tty or CONIN$/CONOUT$,
|
||||
// bypassing standard input and output, so this UI can be used even when
|
||||
// standard input or output are redirected.
|
||||
func NewTerminalUI(printf, warningf func(format string, v ...interface{})) *ClientUI {
|
||||
func NewTerminalUI(printf, warningf func(format string, v ...any)) *ClientUI {
|
||||
return &ClientUI{
|
||||
DisplayMessage: func(name, message string) error {
|
||||
printf("%s plugin: %s", name, message)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package age_test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user