Why the first letter of the method in the custom package is still undefined

stack.go

package stack

type Stack struct{
    i        int
    data  [10]int
}

func (S *Stack) Push(n int) {
    S.data[S.i] = n
    S.iPP
}

demothree.go

package main

import(
"fmt"
"stack"
)

func main() {
    var s stack.Stack
    fmt.Println(s)
    stack.Push(8)
    fmt.Println(s)
}

execution result:

 go run demothree.go
-sharp command-line-arguments
.\demothree.go:11:2: undefined: stack.Push

looking at the answers to the tutorial book, it is still very distressing.

Mar.14,2021

stack.Push does not have this function. Push is a method of the Stack structure. You should write s.Push .

Menu