I am using go version go1.11.2 windows/amd64 in windows 10
i have folder in desktop with name "GoPro" which has one file - main.go one folder - Modules
The "Modules" folder contains one file - Modules.go
Folder Structure
Desktop
|------->GoPro
|----->main.go
|----->Models
|---->Models.go
main.go
// desktop/GoPro/main.go
package main
import (
"./Models"
)
func main() {
Models.Printhello()
}
Models.go
// desktop/GoPro/Models
package Models
import "fmt"
func Printhello() {
fmt.Println("Hello")
}
If try to run the main.go , I am getting the below error , Go recongise the package but it saying undefined.
go run main.go
command-line-arguments
.\main.go:8:2: undefined: Models
The folder is not in GOPATH. I am just trying to import the package with in sub folder of main.go