Go assignment by slice, array unpacking or destructuring
Install the package using
$ go get github.com/thedevsaddam/unpack
To use the package import it in your *.go
code
import "github.com/thedevsaddam/unpack"
Let's see a quick example:
package main
import (
"fmt"
"github.com/thedevsaddam/unpack"
)
func main() {
names := []string{"Captain Jack Sparrow", "Tom", "Jerry"}
var jack, tom string
unpack.Do(names, &jack, &tom)
fmt.Println("I'm", jack)
}
If you encounter any bugs or issues, feel free to open an issue at github.
Also, you can shoot me an email to mailto:thedevsaddam@gmail.com for hugs or bugs.
If you are interested to make the package better please send pull requests or create an issue so that others can fix. Read the contribution guide here
The unpack is an open-source software licensed under the MIT License.