Golang fmt.PrintLn gets hung while trying to rotate array with larger numbers


I am new to Golang and for practice purpose I was trying to solve a question which require to rotate an array for certain iteration. But my code able to print the resultant array with size of 30k elements and is getting hung in print while the array size is bigger (89k). Please help me with the solution.My code mentioned below:

package main

    import (

func rotate(arr []string,count,elem int) string {
    if count > elem {
        count = int(math.Mod(float64(count), float64(elem)))
    return strings.Join(arr[len(arr)-count:]," ")+" "+strings.Join(arr[:len(arr)-count]," ")

func main() {
    var tc,elem,rot int
    var d string
    for i := 0; i < tc; i++ {
        for j:=0;j<elem;j++{
        fmt.Println(strings.Trim(rotate(myrr,rot,elem)," "))

hi there,
what is the problem, I can’t reproduce it.
I’m able to print 98k-index array/slice

        // create 98k slice
        a := make([]string, 98000)
        // fill `a` with example data
        for i := range a {
                a[i] = strconv.Itoa(i)
        // print `a`

Hi @gucio321,

Thanks for the reply.

I have tried your code in my local setup and the code works fine. But whenever I tried any online compiler like https://www.tutorialspoint.com/execute_golang_online.php I see its getting hung. I have tried in various website and observed the same. Also I have observed It was unbale to scan with a input of 98k. Please download the sample text file from this https://drive.google.com/file/d/1YzVJ_zWln10KXe3NniOJvaWwYQBIyMon/view?usp=sharing
The input file works fine with Python while try to scan 89k numbers but get hang with golang.

Please let me know if you are able to run my code with the input file provided. Here 1st line denote the “number of test case”,second line denotes two elements:One is number of elements to strore in any array and second is number of rotation in the array, the third line denotes all the elements.

Thanks and Regards,

Right, posted by you link to a compiler doesn’t compile my programm. It might have some protections to avoid performancy issues
However, other of online compilers, I found works fine: