From 1640f5da67acc7b438c3b80a3714865ae6eee2ca Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 3 Feb 2025 00:42:04 +0000 Subject: [PATCH] Add .github/workflows/go.yaml --- .github/workflows/go.yaml | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/go.yaml diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml new file mode 100644 index 0000000..f8def07 --- /dev/null +++ b/.github/workflows/go.yaml @@ -0,0 +1,41 @@ +name: Go + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + runs-on: ubuntu-latest # You can change this to macos-latest or windows-latest if needed + + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 'stable' # You can specify a specific version or 'stable' + + - name: Build + run: go build -v./... + + - name: Test + run: go test -v./... + + - name: Run gofmt (optional) + # Uncomment to check code formatting with gofmt + run: | + if [ -n "$(gofmt -l.)" ]; then + echo "Go code is not formatted. Please run 'gofmt -w.' to fix it." + exit 1 + fi + + - name: Run golint (optional) + # Uncomment to check code style with golint + run: | + if [ -n "$(golint./...)" ]; then + echo "Go code has style issues. Please run 'golint./...' to see them." + exit 1 + fi \ No newline at end of file