I am Trying to import package and getting error , what could be solution of this error?

could not import myproject/game/helper2 (cannot find package “myproject/game/helper2” in any of
/usr/local/go/src/myproject/game/helper2 (from $GOROOT)
/home/prasnjit/dev/go/src/myproject/game/helper2 (from $GOPATH))compiler

the screen shot of code is attached below

Hi! You should change your import statement with import "myproject/game" and call the public function Get with game.Get(). my project/game sees all public types and declarations and you always can use/call them with the package name as prefix , in this case game..

but game.Get can call the function which is in helper2.go

no, it’s possible only if you import the package in the right way import moduleName/packageName

have tried what you said but couldn’t fix the problem

change helper2.Get() into game.Get() and remove the suffix string /helper2 from import

tried see still error is their

Ahhh you’re creating a go module with main name! :smiley: , you mustn’t create any kind of identifier , package or module with a name already used in Go global scope. Create again your module with go mod init myproject or simply change go.mod first line