Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate test main #120

Closed
GinFungYJF opened this issue Sep 28, 2016 · 1 comment
Closed

generate test main #120

GinFungYJF opened this issue Sep 28, 2016 · 1 comment

Comments

@GinFungYJF
Copy link
Contributor

When I use bazel to build my go_test, it shows the error:

ERROR: /root/testgo/hsa-service-center/src/servicecenter/controllers/BUILD:35:1: null failed: linux-sandbox failed: error executing command /root/.cache/bazel/_bazel_root/40633db3e907142ca23269a67b71fa41/execroot/src/_bin/linux-sandbox ... (remaining 3 argument(s) skipped). bazel-out/local-fastbuild/bin/servicecenter/controllers/instance_watcher_main_test.go:7: imported and not used: "servicecenter/controllers/instance_watcher" as undertest Target //servicecenter/controllers:instance_watcher failed to build

but when I delete the line https://github.com/bazelbuild/rules_go/blob/master/go/tools/generate_test_main.go#L95 ,
it works. Is it a bug?

@pmbethe09
Copy link
Member

Not a bug, but it looks like if !HasTestMain && len(Names) == 0 then the
package undertest is not used.
But that is a useless test -- if there is no TestMain being called, and no
Test* functions, then nothing will happen.
If anything is missing, it is that we don't have something that errros out
if the above condition is true just before the "tmp :=" line you linked.

On Wed, Sep 28, 2016 at 5:06 AM, GinFungYJF notifications@github.com
wrote:

When I use bazel to build my go_test, it shows the error:

ERROR: /root/testgo/hsa-service-center/src/servicecenter/controllers/BUILD:35:1:
null failed: linux-sandbox failed: error executing command
/root/.cache/bazel/_bazel_root/40633db3e907142ca23269a67b71fa
41/execroot/src/_bin/linux-sandbox ... (remaining 3 argument(s) skipped).
bazel-out/local-fastbuild/bin/servicecenter/controllers/
instance_watcher_main_test.go:7: imported and not used:
"servicecenter/controllers/instance_watcher" as undertest
Target //servicecenter/controllers:instance_watcher failed to build

but when I delete the line https://github.com/bazelbuild/
rules_go/blob/master/go/tools/generate_test_main.go#L95 ,
it works. Is it a bug?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#120, or mute the thread
https://github.com/notifications/unsubscribe-auth/ALF-0j18JYvO9Y9tQktTAbSeTyzhxMNCks5qui4mgaJpZM4KIlJO
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants