使用IntelliJ调试Go单个文件

I'm trying to launch a file in debug mode in IntelliJ.

Here is my File content :

package myPackage

import (
    "fmt"
)

func main() {
    fmt.Println("Hello")
}

My file is in the folder src/myProject/myPackage

But when I try to create a Go Application in IntelliJ, it says:

"Cannot find Go file with main in 'myProject/myPackage'"

I have already make this work but I had to put my file in a package named "main".
But now my project is growing and I need to Debug my packages separately.

Any Ideas?

architecture for your app need to be like that :

$Gopath/src/FOLDER_NAME :
|- main.go
|-- my_package/file1.go

in your file1.go

package my_package

import "fmt"

func testwork() {

   fmt.Println("it works !!")
}

in your main.go

package main

import (
    "fmt"
    "FOLDER_NAME/my_package"
)

func main() {
    my_package.testwork()
}

And it will work :)

Currently debugging works only for Go Application run configurations. There's a PR in progress to fix this, see this.