In $GOPATH/src/testapp
I have two files
main.go
otherfile.go
main.go has
package main
import "fmt"
func main() {
fmt.Println(SomeFunc())
}
otherfile.go has
package main
func SomeFunc() string {
return "a thing"
}
When I try to run with go run main.go
, I get an error
./main.go:6: undefined: SomeFunc
I thought I could create another file with package main
and code in main.go
would have access to its declarations. Why doesn't this work? How would I do something like this?