'How to import a single go file in golang? Unable to import go file

Trying to import a file go file but unable to do so.

I have one main file:

    main/
      main.go  
      go_single_file.go

package main

import (
"./go_single_file"
)

func main() {

}

and go_single_file:

package go_single_file

func hello() bool{
return true
}

when i try to import go_single_file in my main file i get some sort of import error.

I am doing something wrong but not sure what.

If i make a separate package and import it then it works but not if it's in same folder.

Can anyone tell how can i import a go file from same folder.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source