Problem with import "not an importable package"

In my GOPATH I have two directories under src “metrics” and “myapp”.

In metrics, there is a “metrics.go” which defines a struct, and some methods.

In “myapp” I have “main.go” which needs to use “metrics”. I have

import "metrics"

When I try to compile “myapp” I get:

import "metrics" is a program, not an importable package

Any idea why?

3 Likes

Just figured it out. In “metrics.go” the package was set to “main” instead of something like “metrics”.

8 Likes

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