Skip to content

support tdbctl primary switch #20

support tdbctl primary switch

support tdbctl primary switch #20

Workflow file for this run

# https://github.com/GoogleCloudPlatform/golang-samples/actions/runs/750090553/workflow
name: Go Lint
on:
workflow_dispatch:
push:
paths:
- "dbm-services/**"
pull_request:
paths:
- "dbm-services/**"
jobs:
build:
name: Build and Lint
runs-on: ubuntu-20.04
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@v0.24.0
- name: Check code
uses: actions/checkout@v4
- run: goimports -w .
- name: Run go mod tidy on all modules
run: find . -name go.mod -execdir go mod tidy \;
# If there are any diffs from goimports or go mod tidy, fail.
- name: Verify no changes from goimports and go mod tidy.
run: |
if [ -n "$(git status --porcelain)" ]; then
echo 'To fix this check, run "goimports -w . && find . -name go.mod -execdir go mod tidy \;"'
git status # Show the files that failed to pass the check.
exit 1
fi
# TODO
# - name: go vet
# # Use find to build all modules. '-execdir ... ;' doesn't set an exit code
# # based on command results. So, create a file if a build fails and check
# # if the file exists to set the right exit code.
# run: |
# ROOT_DIR=$(pwd) \
# find . -name go.mod -execdir sh -c 'go vet ./... || touch $ROOT_DIR/vet_failed.txt' \; ; \
# test ! -f vet_failed.txt
# - name: Build code
# # Use find to build all modules. '-execdir ... ;' doesn't set an exit code
# # based on command results. So, create a file if a build fails and check
# # if the file exists to set the right exit code.
# run: |
# ROOT_DIR=$(pwd) \
# find . -name go.mod -execdir sh -c 'go build ./... || touch $ROOT_DIR/build_failed.txt' \; ; \
# test ! -f build_failed.txt
# - name: shellcheck
# run: find . -name "*.sh" -exec shellcheck {} \;