Skip to content

Commit

Permalink
Merge pull request #1 from ldez/fix/misc
Browse files Browse the repository at this point in the history
chore: fix CI, readme and gitignore
  • Loading branch information
karamaru-alpha committed Feb 14, 2024
2 parents bea9677 + efa47f9 commit 04a4e4b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go 1.22
uses: actions/setup-go@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: stable
- name: Run test
run: go test -v ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.54
version: v1.56
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
copyloopvar
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
## copyloopvar
# copyloopvar

copyloopvar is a linter detects places where loop variables are copied.

cf. [Fixing For Loops in Go 1.22](https://go.dev/blog/loopvar-preview)

## Example

```go
for i, v := range []int{1, 2, 3} {
i := i // It's unnecessary to copy the loop variable "i"
Expand All @@ -18,7 +20,8 @@ for i := 1; i <= 3; i++ {
```

## Install

```bash
go install github.com/karamaru-alpha/copyloopvar/cmd/copyloopvar
go install github.com/karamaru-alpha/copyloopvar/cmd/copyloopvar@latest
go vet -vettool=`which copyloopvar` ./...
```

0 comments on commit 04a4e4b

Please sign in to comment.