0

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.

Exploring
  • 925
  • 6
  • 18

1 Answers1

0

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
rosmak
  • 545
  • 1
  • 12
  • Initially I was using only assert package. But now I want to use suite also, how will I do that then? Please let me know. – Exploring Mar 24 '23 at 13:48