Golang reflect.DeepEqual() function example
package reflect
Golang reflect.DeepEqual() function usage example
package main
import (
"fmt"
"reflect"
)
func main() {
var oldSlice string
var newSlice string
bool := reflect.DeepEqual(oldSlice, newSlice)
fmt.Println(bool)
oldSlice = "abc"
newSlice = "def"
bool = reflect.DeepEqual(oldSlice, newSlice)
fmt.Println(bool)
newSlice = "abc"
bool = reflect.DeepEqual(oldSlice, newSlice)
fmt.Println(bool)
}
output :
true
false
true
Reference :
Advertisement
Something interesting
Tutorials
+43.5k Golang : Get hardware information such as disk, memory and CPU usage
+16.4k Golang : Test floating point numbers not-a-number and infinite example
+21.8k SSL : How to check if current certificate is sha1 or sha2
+18.7k Golang : Implement getters and setters
+10.5k Golang : Create matrix with Gonum Matrix package example
+10.3k Golang : Convert file content to Hex
+16.4k Golang : How to implement two-factor authentication?
+10.5k Generate Random number with math/rand in Go
+7.8k Golang : Load DSA public key from file example
+33.7k Golang : All update packages with go get command
+7.4k Golang : Hue, Saturation and Value(HSV) with OpenCV example