I am trying to write a program where I have a structure like:
Go/src/
-github.com
-myname
-hello
main.go
-vector
vector.go
When I import the package in my code inside of the main.go
file using a command like:
import(
"vector"
)
I get the error message:
Can't find package "vector" in any of:
C:\Go\src\vendor\vector (vendor tree)
C:\Go\src\vertex (from $GOROOT)
C:\Go\src\github.com\myname\src\vertex (from $GOPATH)
Why is it adding src
on that last line? Shouldn't it replace the src with the hello folder since that is where I'm running the file from? Also, it runs if I import it from the full file structure like github.com/myname/hello/vertex
which seems strange to me.
I am executing using go run hello.go
to simplify my interaction with the program.