mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-12 18:37:54 +08:00
825ba2d081
* Replaced errors.Wrap with fmt.Errorf (#589) * Find: errors\.Wrap\(([^,]+),\s+(["`][^"`]*)(["`])\) Replace: fmt.Errorf($2: %w$3, $1) * Replaced errors.Wrapf with fmt.Errorf (#589) * Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])\) Replace: fmt.Errorf($2: %w$3, $1) * Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])(,[^)]+)\) * Replace: fmt.Errorf($2: %w$3$4, $1) * Replaced errors.Errorf with fmt.Errorf (#589) * Find: errors\.Errorf Replace: fmt.Errorf * Cleaned up remaining imports * Cleanup * Regenerate provider support matrix This was broken by #533 ... and it's now the third time this has been missed.
28 lines
595 B
Go
28 lines
595 B
Go
package models
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/gob"
|
|
"fmt"
|
|
"strconv"
|
|
)
|
|
|
|
func copyObj(input interface{}, output interface{}) error {
|
|
buf := &bytes.Buffer{}
|
|
enc := gob.NewEncoder(buf)
|
|
dec := gob.NewDecoder(buf)
|
|
if err := enc.Encode(input); err != nil {
|
|
return err
|
|
}
|
|
return dec.Decode(output)
|
|
}
|
|
|
|
// atou32 converts a string to uint32 or panics.
|
|
// DEPRECATED: This will go away when SOA record handling is rewritten.
|
|
func atou32(s string) uint32 {
|
|
i64, err := strconv.ParseUint(s, 10, 32)
|
|
if err != nil {
|
|
panic(fmt.Errorf("atou32 failed (%v) (err=%v", s, err))
|
|
}
|
|
return uint32(i64)
|
|
}
|