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 .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3be25-2c2c6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3be25-2c2c6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?