I have some problem with Golang and include package. I have that scructure
src/
├── hello_world
│ ├── hello.go
│ └── math
│ └── add.go
hello.go file contains this code:
package main
import (
"fmt"
math "hello_world/math"
)
func main() {
fmt.Println("Hello World")
x := math.add(6, 5)
}
and add.go
package math
func add(x, y int) int {
return x + y
}
and when I do go run hello go
I see:
evgen@laptop:~/go/src/hello_world$ go run hello.go
# command-line-arguments
./hello.go:10: cannot refer to unexported name math.add
./hello.go:10: undefined: "hello_world/math".add
GOPATH:
evgen@laptop:~/go/src/hello_world$ echo $GOPATH
/home/evgen/go
How fix it? Thanks you!