Skip to content

Commit

Permalink
ci: add golangci-lint to GitHub Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
angelicagardner authored Jun 12, 2024
2 parents 4b39308 + 8a3f9d0 commit 9520a56
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 10 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Golang Linting

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Run golangci-lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21'

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
- name: Print Go environment
run: |
go env
- name: Run golangci-lint
run: |
golangci-lint run ./...
35 changes: 35 additions & 0 deletions .github/workflows/rebase-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Rebase dev onto main

on:
push:
branches:
- main

jobs:
rebase-dev:
runs-on: ubuntu-latest

steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
ref: main

- name: Fetch all branches
run: git fetch origin "+refs/heads/*:refs/remotes/origin/*"

- name: Checkout dev branch
run: git checkout dev

- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Rebase dev onto main
run: git rebase main

- name: Push changes
run: git push origin dev --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 0 additions & 10 deletions LeetCode/problem009_PalindromeNumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package leetcode

import (
"fmt"
"math"
)

Expand All @@ -12,7 +11,6 @@ func isPalindrome(x int) bool {
return false
}

// Variables to store the original number and the reversed number
original := x
reversed := 0

Expand All @@ -33,11 +31,3 @@ func isPalindrome(x int) bool {
// Check if the original number is the same as the reversed number
return original == reversed
}

func main() {
// Test the function with a sample input
var x int
fmt.Println("Enter an integer:")
fmt.Scan(&x)
fmt.Println(isPalindrome(x))
}

0 comments on commit 9520a56

Please sign in to comment.