https://github.com/protocol/multiple-go-modules
https://github.com/protocol/multiple-go-modules
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/protocol/multiple-go-modules
- Owner: protocol
- License: other
- Created: 2021-05-08T18:05:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T17:11:04.000Z (over 2 years ago)
- Last Synced: 2024-10-15T19:31:53.309Z (over 1 year ago)
- Size: 11.7 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# GitHub Action: multiple-go-modules
Go allows a Git repository to contain multiple Go modules (i.e. multiple directory trees that have their own `go.mod` file).
When running Go tools like `go test ./...` or `go vet ./...` from the parent directory, it will only recurse into directories belonging to the same Go module.
In order to run the command in all subdirectories, no matter which module they belong to, the command has to be invoked separately for every Go module.
This GitHub Action makes it easy to do this.
## Usage
Take the following example, running a command (or multiple commands) directly:
```yml
steps:
- name: Code Quality Checks
run: go vet ./...
```
Using this action, this would run the same command(s) in all Go modules:
```yml
steps:
- name: Code Quality Checks
uses: protocol/multiple-go-modules@master
with:
run: go vet ./...
```
Optionally, the working directory can be specified, analagously to the [`working-directory` option on `run`](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun):
```yml
steps:
- name: Code Quality Checks
uses: protocol/multiple-go-modules@master
with:
working-directory: scripts
run: go vet ./...
```