Skip to content
Snippets Groups Projects
Commit 6adf2f09 authored by Jano Hendriks's avatar Jano Hendriks
Browse files

Update DeepCopy to not use json marshalling

parent 2f57bac1
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= ...@@ -83,6 +83,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
......
...@@ -3,7 +3,6 @@ package utils ...@@ -3,7 +3,6 @@ package utils
import ( import (
"archive/zip" "archive/zip"
"bytes" "bytes"
"encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
...@@ -11,7 +10,7 @@ import ( ...@@ -11,7 +10,7 @@ import (
"strings" "strings"
"time" "time"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/struct_utils" "github.com/mohae/deepcopy"
) )
// GetEnv is a helper function for getting environment variables with a default // GetEnv is a helper function for getting environment variables with a default
...@@ -98,16 +97,8 @@ func readZipFile(zipFile *zip.File) ([]byte, error) { ...@@ -98,16 +97,8 @@ func readZipFile(zipFile *zip.File) ([]byte, error) {
return ioutil.ReadAll(zipFileData) return ioutil.ReadAll(zipFileData)
} }
func DeepCopy(toValue interface{}, fromValue interface{}) (err error) { func DeepCopy(fromValue interface{}) (toValue interface{}) {
valueBytes, err := json.Marshal(fromValue) return deepcopy.Copy(fromValue)
if err != nil {
return err
}
err = struct_utils.UnmarshalJSON(valueBytes, toValue)
if err != nil {
return err
}
return nil
} }
func UnwrapBool(b *bool) bool { func UnwrapBool(b *bool) bool {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment