1.uuidのv4を利用すために、google uuidのpkgをimportする
import "github.com/google/uuid" ... // version4 NewRandom _uuid , _ := uuid.NewRandom(); uuid := _uuid.String();
2.srcのbuild
pkgをimportしただけだと以下のbuild errorがでる
# sh build.sh src/sample.go:22:2: cannot find package "github.com/google/uuid" in any of: /usr/lib/golang/src/github.com/google/uuid (from $GOROOT) /root/go/src/github.com/google/uuid (from $GOPATH) # sh build.sh src/sample.go:23:2: invalid import path: "uuid github.com/google/uuid"
3.pkgのinstall
# go get github.com/google/uuid
4.再度srcのbuild
build errorが出なくなる