Ah yes, the canonical problem when learning a new programming language. I have this:
$GOPATH/
src/
huru/
foo/
side.go
hello.go
in hello.go I have:
package main
import (
"encoding/json"
"log"
"net/http"
"github.com/gorilla/mux"
)
func main(){
Foo()
}
and in foo/side.go, I have:
package main
func Foo() {
}
I run:
go install huru
and I get:
# huru
src/huru/hello.go:22:2: undefined: Foo
the compiler doesn't like the Foo()
call in hello.go
, how do I import it properly? Should I be using package main
for both files? Why wouldn't the package be called huru
, I assume I should call the package huru
..instead of main
? idk.