I have a file called login.go and account.go
In login.go
func (api *ApiResource) test() {
fmt.Println("Works!")
}
In account.go I have:
func main () {
Res := new(ApiResource)
Res.test()
}
Buit I'm getting undefined:test
error.
They both use package main
and are on same src/
folder
What do I need to fix here?
If you used go run
then you must pass both files to like go run login.go account.go
.