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 :
Advertisement
Something interesting
Tutorials
+7k Golang : Levenshtein distance example
+17k Golang : Get number of CPU cores
+21.4k Curl usage examples with Golang
+31.5k Golang : bufio.NewReader.ReadLine to read file line by line
+55.3k Golang : Unmarshal JSON from http response
+11.2k Golang : Calculate Relative Strength Index(RSI) example
+23.5k Golang : Get ASCII code from a key press(cross-platform) example
+15.2k Golang : How to add color to string?
+12.1k Golang : Save webcamera frames to video file
+9.1k Golang : Get curl -I or head data from URL example
+8.1k Golang : Check from web if Go application is running or not
+17k Golang : Get input from keyboard