Skip to content

Commit

Permalink
chore: fix License, CI, readme and gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Feb 13, 2024
1 parent a75afc3 commit 7a30017
Show file tree
Hide file tree
Showing 4 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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 karamaru
Copyright (c) 2023-2024 karamaru

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 4 additions & 1 deletion 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,6 +20,7 @@ for i := 1; i <= 3; i++ {
```

## Install

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

0 comments on commit 7a30017

Please sign in to comment.