[Solved] How to import the package in the Go


You must provide only 1 package within single folder. Consider to name package like the folder. In your case create folder “utils” and move your helper.go in there.

Please, don’t forget to name public types, vars and funcs properly: start their names with uppercase symbol:

Finally your project would look like this:

project structure

Your helper.go would look like this:

package util

func SomeFunc() {

}

And your main.go would look like this:

package main

import "stackoverflowexamples/src/util"

func main(){
    util.SomeFunc()
}

solved How to import the package in the Go