How to import a "non main" package

into a package main?

Hello, This error that you are getting is stating that there are 2 package instantiation happening in the same folder/package.

Meaning, goweek.go is a part of package goweek and hello.go is a part of package main in the same folder.

Is the goweek.go (above hello.go) a copy of /Go/grsmv/goweek?

If yes then you need to change the goweek.go from package goweek to package main to directly access its functions (which is not recommended but will work).

Recommended approach: use go get and import it naturally as you did in the above screenshot.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.