decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
731 stars 289 forks source link

build: Rework test script to use go.mod files. #3368

Closed davecgh closed 1 month ago

davecgh commented 1 month ago

This reworks the logic in the test run script for determining which modules to test to use the existence of a go.mod file instead of attempting to use the result of go list.

The existing logic is to determine the root module via go list and then test everything that has that as a prefix. However, that is error prone because indirect dependencies may depend on older versions of modules that are no longer in the repo, but naturally still have the prefix that is specified to test.

Searching for the go.mod files in the repo isn't prone to the aforementioned issue and is generally more robust because it will always be recent as of the current state of the repo and it still has the benefit of dynamically finding all modules in the repo.

davecgh commented 1 month ago

ok but, what is playground?

It's just an area where local test code that has its own modules can live and easily replace things with ../foo without polluting the main module. It could be named anything, but that seemed appropriate to me as it's what I use for that purpose myself.

jrick commented 1 month ago

Ah, ok. I use ~/hack for that myself. With go.work pointing to ~/src/dcrd/foo if i need to integrate another module.

davecgh commented 1 month ago

Ah, ok. I use ~/hack for that myself. With go.work pointing to ~/src/dcrd/foo if i need to integrate another module.

That makes sense too. I just found it easier to put stuff in a subdir so it's already right there in the editor workspace without having to go open it elsewhere.