reflectutil - ActiveState ActiveGo 1.8

Package reflectutil

import ""

Overview ▾

Package reflectutil contains reflect utilities.

func Swapper

func Swapper(slice interface{}) func(i, j int)

Swapper returns a function which swaps the elements in slice. Swapper panics if the provided interface is not a slice.

Its goal is to work safely and efficiently for all versions and variants of Go: pre-Go1.5, Go1.5+, safe, unsafe, App Engine, GopherJS, etc.