mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-21 06:36:06 +00:00
Enable linter revive and resolve found errors: part 1
Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
This commit is contained in:
@@ -35,15 +35,15 @@ import (
|
||||
func Encode(obj runtime.Object, format string) ([]byte, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
if err := EncodeTo(obj, format, buf); err != nil {
|
||||
if err := To(obj, format, buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
// EncodeTo converts the provided object to the specified format and
|
||||
// To converts the provided object to the specified format and
|
||||
// writes the encoded data to the provided io.Writer.
|
||||
func EncodeTo(obj runtime.Object, format string, w io.Writer) error {
|
||||
func To(obj runtime.Object, format string, w io.Writer) error {
|
||||
encoder, err := EncoderFor(format, obj)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -73,8 +73,8 @@ func EncoderFor(format string, obj runtime.Object) (runtime.Encoder, error) {
|
||||
return encoder, nil
|
||||
}
|
||||
|
||||
// EncodeToJSONGzip takes arbitrary Go data and encodes it to GZip compressed JSON in a buffer, as well as a description of the data to put into an error should encoding fail.
|
||||
func EncodeToJSONGzip(data interface{}, desc string) (*bytes.Buffer, []error) {
|
||||
// ToJSONGzip takes arbitrary Go data and encodes it to GZip compressed JSON in a buffer, as well as a description of the data to put into an error should encoding fail.
|
||||
func ToJSONGzip(data interface{}, desc string) (*bytes.Buffer, []error) {
|
||||
buf := new(bytes.Buffer)
|
||||
gzw := gzip.NewWriter(buf)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user