Using dot import in test

Whad does this import mean when we use point in imports?

import (
	"os"
	"testing"

	"." // what is this?
)
2 Likes

It imports the package from the folder the test is in.

This is often easier than spelling it out, but importing is still necessary when one uses a _test package.

Also, IIRC exported items are imported unqualified and will be put directly in the test packages namespace.

2 Likes

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