I am new to Golang. I am trying to clean duplicates. When I try to build the go code, I get this error.
utils.go:60:62: cleanedTransactedFrom declared and not used
I made sure that they are used. I am sorry about the naming conventions. I am very new to Golang, so I am yet to follow the conventions. As of now consider types.TransactedFrom
is a simple struct that has ID
and TimeStamp
.
func removeDuplicates(TransactedFrom [][]types.TransactedFrom) [][]types.TransactedFrom {
cleanedTransactedFrom := [][]types.TransactedFrom{}
equal := true
for index, singleTransactedFrom := range TransactedFrom {
for _, selectedTransactedFrom := range TransactedFrom[index:] {
if reflect.DeepEqual(singleTransactedFrom, selectedTransactedFrom) {
equal = false
}
}
if equal {
cleanedTransactedFrom := append(cleanedTransactedFrom, singleTransactedFrom)
}
equal = true
}
return cleanedTransactedFrom
}