Queue Implementation Issue

We need to do coding for queue implementation, we did as

package main
import "fmt"

type queue struct {
    items []int
}

func (q *queue) insertion(item int) {
    q.items = append(q.items, item)
}

func (q *queue) deletion() {
    if len(q.items) == 0 {
        fmt.Println("Out of Bounds")
    }
    items := q.items[1:]
    q.items = items
}
func main() {
    var n int
    _, err := fmt.Scanln(&n)
    if err != nil || n < 0 {
        return
    }
    q := queue{}
    q.insertion(n)
    q.deletion(n)
}

Not sure where we went wrong

You read a single number from stdin, add it to the queue and then you are calling deletion() with one argument but only have defined deletion() without arguments.

Please also do not just throw some exercise and code at us, but tell us what your problem with your current code is. Do you get an error on compilation? Is the output not as expected? Etc…

Yes, and I told you why. You are calling deletion(n) but there is no deletion function that would take any arguments.

You are reading in the slice of data, and then insert the number of items at the end.

Re read instructions. How many items are you supposed to drop, and how many do you actually drop?

Carefully check the error and also check your failure conditions in the deletion method.

You are trying to drop 3 items from a slice of length 2, you can’t do that. Check if your slice is long enough before dropping.

Issue resolved thanks