how to get the last element of a slice in golang code example Example: golang get last element of slice sl = sl[:len(sl)-1]