diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..64ad731 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,33 @@ +name: Go + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.22' # Use the Go version of your project + - name: Check out code + uses: actions/checkout@v2 + - name: Cache Go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Install golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.56.2 # Use the version of golangci-lint you want + args: --config .golangci.yml ./... # Optional: specify config file and directories to lint + - name: Run Tests + run: go test -v ./... diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..6f9d695 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,20 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0.8 + +linters: + enable: + - govet + - golint + - gofmt + - goimports + disable: + - errcheck + +issues: + exclude-rules: + - linters: + - golint + text: "should have comment or be unexported" # Example: exclude a specific rule \ No newline at end of file