package main import ( "github.com/mattheath/goflake" "github.com/joaojeronimo/go-crc16" "fmt" "time" ) func main() { // Create a new goflake with a worker id, these must be unique. hostid := uint32(crc16.Crc16([]byte("hostname1"))) fmt.Println(hostid) if v, err := goflake.New( uint32(crc16.Crc16([]byte("hostname1"))) ) ; err !=nil { fmt.Println(err) }else{ for i := 0; i < 10; i++ { id, _ := v.Generate() time.Sleep(time.Second) fmt.Println(id) } } }