I am making a Go project containing a few packages. Those are data structures (and there will be algorithms as well). My project root looks like this:
C:.
├───array
├───binary_tree
├───heap
└───list
The thing is, I want to add like a CI. So I would have a job checking if all packages build and if all tests pass.
Unfortunately, I can't run go build
on project root. I have to pass whole path to it. I mean I could write a script which calls go build X/Y/foo
and then go build X/Y/bar
, but the CI on GitLab (docker image) won't have those paths, it will just git clone
my repo and that's it (cuz I cannot run it on a relative path from project root, but a relative path from GOPATH
, so like github.com/dabljues/project_name/array
). And what about the test?
So the question there would be: Can I somehow run go build
and go test
for all the packages in the Go project? (located in separate folders)