Export to GitHub

godag - issue #2

Tests being linked in to binaries.


Posted on Nov 6, 2011 by Swift Rabbit

Godag includes tests in binaries.

How to reproduce: 1. Create a package with a test. Add a print statement in *_test.go init function. 2. Create a program that includes that package. 3. Build the program and start it up.

The test init() func will print.

I think the right behavior is that tests should be excluded.

Comment #1

Posted on Nov 10, 2011 by Swift Cat

That definetly sounds like a bug.

I was able to reproduce the problem, and I think I found the reason for it.

If a package (pkg) contains a pkg_test.go file as part of the package, which is only to be included during unit-testing, that package will cause problems; unless it is recompiled without the test flag prior to linking.

I don't have an elegant fix for it at the moment, suggestions are very welcome! :-)

Comment #2

Posted on Nov 16, 2011 by Swift Cat

Added a fix for this issue, it's available at the tip of the repo, i.e.

$ hg pull $ hg update

should do the trick, did not move the release version yet, hopefully it works as expeced. it's not beautiful since packages are recompiled after testing if this problem occurs...

Comment #3

Posted on Nov 18, 2011 by Swift Rabbit

I just tried it out and confirmed that it is working.

Thanks! :)

Comment #4

Posted on Dec 1, 2011 by Swift Cat

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium