Multiple checkouts vs passing source code via workflows

I’m just getting started with CircleCI. Something I’m not clear on… just using Golang as an example:

  • In my first job, I run “checkout” and then install a whole bunch of 3rd party dependencies into a vendor folder via one of these three tools: Go Mod, Go Dep, or Glide. The additional dependencies seems like a great candidate for caching using the lock file as a hash.
  • My question: is it a best practice to perform this exact same sequence of steps for all subsequent jobs as well (and individually caching these steps as well)? I’ve observed that some config files that I’ve found online will instead pass all source code to the next job using persist_to_workspace. Is this good or bad practice? Is it correct that persist_to_workspace is an expensive operation that should generally only be used for build artifacts?