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.