joshdk/go-junit

Wow! You added a lot of dependencies.

E-B-Smith opened this issue · 3 comments

Thanks for writing this, it's helpful!

I'm surprised at the number of dependencies you've added.

👋 Hi @E-B-Smith!

I'm glad to hear that this library has been helpful to you! Can you describe which dependencies you are seeing in some more detail please? The only dependency should be github.com/stretchr/testify as stated in the go.mod here.

Additionally, due to the way go modules work, this dependency (and the transitive dependencies which can be seen in go.sum here) should only ever be fully downloaded if you go test the repo, as testify only appears as an import in the *_test.go files.

According to a comment made by rsc (golang/go#26913 (comment)) go build will still contact the git repos of these dependencies, but only to download their go.mod files. As an experiment, I tried the following:

  1. Create and cd into a temp directory (mktemp -d), unset GOPATH, export GO111MODULE=on, and rm -rf ~/go for good measure.

  2. Take the first code snippet from the README.md, and wrap it in a simple main.

  3. Did a go run

time go run main.go
go: finding github.com/joshdk/go-junit latest
go: downloading github.com/joshdk/go-junit v0.0.0-20191003040041-8660fd52f6ac
go: extracting github.com/joshdk/go-junit v0.0.0-20191003040041-8660fd52f6ac
go: finding github.com/stretchr/testify v1.4.0
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/stretchr/objx v0.1.0
go: finding gopkg.in/yaml.v2 v2.2.2
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
JUnitXmlReporter
JUnitXmlReporter.constructor
  should default path to an empty string
    failed: Assertion failed
  should default consolidate to true
    skipped
  should default useDotNotation to true
    passed

real	0m10.578s
user	0m1.037s
sys	0m1.011s
  1. Check what got downloaded
find $HOME/go -name '*.go'
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/ingest_test.go
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/ingest.go
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/types.go
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/parse_test.go
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/ingesters.go
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/node.go
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/parse.go
find $HOME/go -name '*.mod'
/Users/josh/go/pkg/mod/cache/download/gopkg.in/yaml.v2/@v/v2.2.2.mod
/Users/josh/go/pkg/mod/cache/download/gopkg.in/check.v1/@v/v0.0.0-20161208181325-20d25e280405.mod
/Users/josh/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.0.mod
/Users/josh/go/pkg/mod/cache/download/github.com/pmezard/go-difflib/@v/v1.0.0.mod
/Users/josh/go/pkg/mod/cache/download/github.com/stretchr/objx/@v/v0.1.0.mod
/Users/josh/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.4.0.mod
/Users/josh/go/pkg/mod/cache/download/github.com/joshdk/go-junit/@v/v0.0.0-20191003040041-8660fd52f6ac.mod
/Users/josh/go/pkg/mod/github.com/joshdk/go-junit@v0.0.0-20191003040041-8660fd52f6ac/go.mod

Conclusion - So 10 seconds to first run the code is a little gross, but it certainly didn't appear to download any code files for those dependencies (only their .mod files). Additionally, if you go run a second time, it does none of this (as the .mod files are cached).


In the end, this repo is not supposed to introduce a lot of overhead (I wanted it to be super lightweight), but the end-user might still feel an impact from the test dependencies. I've gone and filed #32 to investigate what removing testify would look like. That being said, any repo that is already using testify (which is a lot!) would probably never notice, as things should just work seamlessly.

Cheers!

@E-B-Smith are you by any chance referring to the dependencies that scroll by when you run make lint? Some more information on what you're experiencing from your side would be helpful.

Cheers!

Closing due to insufficient information. Happy to reopen if that changes.