Golang container/ring.New() function example

package container/ring

New creates a ring with the given input (n) elements.

Golang container/ring.New() function usage example

 package main

 import (
 "container/ring"
 "fmt"
 )

 func main() {
 r := ring.New(10)

 fmt.Printf("Ring size is : %d\n", r.Len())

 }

Output :

Ring size is : 10

Reference :

http://golang.org/pkg/container/ring/#New

Advertisement