All packages of golang testify not getting download

346 Views Asked by At

Am trying to download all testify packages of Golang. I am running go get github.com/stretchr/testify. After that if I run go mod vendor only assert package is getting download. I need other packages too, like suite, mock but for some reason not getting those. Not able to get what is the reason. Also am using VSCode for development and using VSCode terminal to download the packages. I didn't face the same for other packages.

1

There are 1 best solutions below

1
rosmak On

It happens because in your code you are using only assert functionality. Most packages in testify are independent, and they don't call any other packages internally.

Lets say for example, if assert package had a function that was calling other function from mock package. Then both of them would be vendored.

If you want to use any other package, just import it with:

import (
   ...
  "github.com/stretchr/testify/mock"
)

And again do:

go mod vendor