diff --git a/.github/workflows/go-vet.yml b/.github/workflows/go-vet.yml new file mode 100644 index 0000000..78dfe41 --- /dev/null +++ b/.github/workflows/go-vet.yml @@ -0,0 +1,45 @@ +name: Go Vet + +on: + push: + branches: + - master + pull_request: + branches: + - master + paths-ignore: + - 'docs/**' + - '**/*.md' + +jobs: + static-analysis: + # 定义矩阵的值,指定不同的平台 + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.19' + + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install Dependencies + run: go mod download + + - name: Run Go Vet + run: go vet ./... \ No newline at end of file