Import "github.com/abcd/xyz" is a program, not an importable package.

Does your main_test.go file declare a package “main_test”? (The error message indicates this.) If so, change this to package main. Then your test code is in the same package as the main code and needs no import.

If this still does not work, please post minimal sample code (a main.go and a main_test.go file with just enough code to trigger the error). I feel that there is currently too much guesswork going on, it would be helpful to have a complete test case available to reason about.

1 Like

I changed to package main in main_test.go file.
Now that error is resolved. Thanks for that help @christophberger :slight_smile:

As of now there is no import statement for that package (main.go).
I got few errors of undeclared statement for “FakeCommandExecutor”

I am developing a plugin in go. So main.go is completely based on sample go plugin code.
I am attaching sample code for your further reference.

Main.go : https://play.golang.org/p/rj-Yc3lRsj7
Main_test.go : https://play.golang.org/p/ZmhZngVPqcW

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