У меня есть некоторые проблемы с Golang и включают в себя пакет. У меня есть, что scructureGolang импортные пакеты
src/
├── hello_world
│ ├── hello.go
│ └── math
│ └── add.go
hello.go файл содержит этот код:
package main
import (
"fmt"
math "hello_world/math"
)
func main() {
fmt.Println("Hello World")
x := math.add(6, 5)
}
и add.go
package math
func add(x, y int) int {
return x + y
}
и когда я go run hello go
я вижу:
[email protected]:~/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:
[email protected]:~/go/src/hello_world$ echo $GOPATH
/home/evgen/go
Как это исправить? Спасибо вам!
Hah! Я тупой! Большое вам спасибо! –