Golang没有看到其他文件的功能

I have main.go file

package main

func main() {
    func2()
}

func2 is defined in file2.go:

package main

func func2(){
    ...
}

Everything is OK when I compile and run it from a command line:

go run main.go file2.go

But when I run it from Goland by pressing RUN it gives me an error:

# command-line-arguments
./main.go:95: undefined: func2

How should I overcome it?

Go to Run | Edit Configurations and change the run configuration to point from file to a package, the package name must be fully qualified (for example: github.com/user/package)