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
+4.7k Golang : Grab news article text and use NLP to get each paragraph's sentences
+10.7k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+9.7k Golang : Command line file upload program to server example
+7.5k Golang : Count leading or ending zeros(any item of interest) example
+10.5k Get form post value in Go
+8.5k Golang : Copy map(hash table) example
+6.4k Android Studio : AlertDialog to get user attention example
+10k Android Studio : Create custom icons for your application example
+9.8k Golang : Sieve of Eratosthenes algorithm
+5.1k Golang : Missing Subversion command
+20k Golang : Convert string slice to struct and access with reflect example
+3.8k Golang : How to pass data between controllers with JSON Web Token