Enable stylecheck linter and resolve found issues.

Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
This commit is contained in:
Xun Jiang
2023-04-25 13:50:52 +08:00
parent 980106dc39
commit bbc1e2e151
40 changed files with 215 additions and 227 deletions

View File

@@ -122,19 +122,19 @@ type OperationsForBackup struct {
ErrsSinceUpdate []string
}
func (in *OperationsForBackup) DeepCopy() *OperationsForBackup {
if in == nil {
func (m *OperationsForBackup) DeepCopy() *OperationsForBackup {
if m == nil {
return nil
}
out := new(OperationsForBackup)
in.DeepCopyInto(out)
m.DeepCopyInto(out)
return out
}
func (in *OperationsForBackup) DeepCopyInto(out *OperationsForBackup) {
*out = *in
if in.Operations != nil {
in, out := &in.Operations, &out.Operations
func (m *OperationsForBackup) DeepCopyInto(out *OperationsForBackup) {
*out = *m
if m.Operations != nil {
in, out := &m.Operations, &out.Operations
*out = make([]*itemoperation.BackupOperation, len(*in))
for i := range *in {
if (*in)[i] != nil {
@@ -144,17 +144,17 @@ func (in *OperationsForBackup) DeepCopyInto(out *OperationsForBackup) {
}
}
}
if in.ErrsSinceUpdate != nil {
in, out := &in.ErrsSinceUpdate, &out.ErrsSinceUpdate
if m.ErrsSinceUpdate != nil {
in, out := &m.ErrsSinceUpdate, &out.ErrsSinceUpdate
*out = make([]string, len(*in))
copy(*out, *in)
}
}
func (o *OperationsForBackup) uploadProgress(backupStore persistence.BackupStore, backupName string) error {
if len(o.Operations) > 0 {
func (m *OperationsForBackup) uploadProgress(backupStore persistence.BackupStore, backupName string) error {
if len(m.Operations) > 0 {
var backupItemOperations *bytes.Buffer
backupItemOperations, errs := encode.EncodeToJSONGzip(o.Operations, "backup item operations list")
backupItemOperations, errs := encode.EncodeToJSONGzip(m.Operations, "backup item operations list")
if errs != nil {
return errors.Wrap(errs[0], "error encoding item operations json")
}
@@ -163,7 +163,7 @@ func (o *OperationsForBackup) uploadProgress(backupStore persistence.BackupStore
return errors.Wrap(err, "error uploading item operations json")
}
}
o.ChangesSinceUpdate = false
o.ErrsSinceUpdate = nil
m.ChangesSinceUpdate = false
m.ErrsSinceUpdate = nil
return nil
}

View File

@@ -122,19 +122,19 @@ type OperationsForRestore struct {
ErrsSinceUpdate []string
}
func (in *OperationsForRestore) DeepCopy() *OperationsForRestore {
if in == nil {
func (m *OperationsForRestore) DeepCopy() *OperationsForRestore {
if m == nil {
return nil
}
out := new(OperationsForRestore)
in.DeepCopyInto(out)
m.DeepCopyInto(out)
return out
}
func (in *OperationsForRestore) DeepCopyInto(out *OperationsForRestore) {
*out = *in
if in.Operations != nil {
in, out := &in.Operations, &out.Operations
func (m *OperationsForRestore) DeepCopyInto(out *OperationsForRestore) {
*out = *m
if m.Operations != nil {
in, out := &m.Operations, &out.Operations
*out = make([]*itemoperation.RestoreOperation, len(*in))
for i := range *in {
if (*in)[i] != nil {
@@ -144,17 +144,17 @@ func (in *OperationsForRestore) DeepCopyInto(out *OperationsForRestore) {
}
}
}
if in.ErrsSinceUpdate != nil {
in, out := &in.ErrsSinceUpdate, &out.ErrsSinceUpdate
if m.ErrsSinceUpdate != nil {
in, out := &m.ErrsSinceUpdate, &out.ErrsSinceUpdate
*out = make([]string, len(*in))
copy(*out, *in)
}
}
func (o *OperationsForRestore) uploadProgress(backupStore persistence.BackupStore, restoreName string) error {
if len(o.Operations) > 0 {
func (m *OperationsForRestore) uploadProgress(backupStore persistence.BackupStore, restoreName string) error {
if len(m.Operations) > 0 {
var restoreItemOperations *bytes.Buffer
restoreItemOperations, errs := encode.EncodeToJSONGzip(o.Operations, "restore item operations list")
restoreItemOperations, errs := encode.EncodeToJSONGzip(m.Operations, "restore item operations list")
if errs != nil {
return errors.Wrap(errs[0], "error encoding item operations json")
}
@@ -163,7 +163,7 @@ func (o *OperationsForRestore) uploadProgress(backupStore persistence.BackupStor
return errors.Wrap(err, "error uploading item operations json")
}
}
o.ChangesSinceUpdate = false
o.ErrsSinceUpdate = nil
m.ChangesSinceUpdate = false
m.ErrsSinceUpdate = nil
return nil
}