Issues regarding importing

I’ve a src file in <base_dir>/pkg/logging.go (package logging) and i want to import a Logger struct into <base_dir>/http/app_app.go (package http)

main.go
logger "github.com/tobigiwa/golang-security-backend/pkg/logging"

the compiler still complains as brokenimport, what am i doing wrongly?

Hi @Oluwatobi_Giwa,

Move logging.go into a directory that has the name of the package, and your import should work fine:

<base_dir>/pkg/logging/logging.go

Or rename the pkg directory to logging. A pkg directory is not always necessary.

1 Like

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