Calling function from same package in different file

Hi People ,

I am not able to call a function names as foo that is in my main package but the files are different . Both the files are in same src folder.
The Code is shared in the Screeshot.

Could you please help me with this ! Thanks In Advance

You are trying to run code from one file but you have two files

go run .\src\main.go .\src\foo.go 
1 Like

Maybe the folder structure should be src > main > foo.go + main.go ?

1 Like


You can also run, in you main package:

go run .
1 Like

Thank You Everyone, It is working

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.