Skip to content

Commit dfe872c

Browse files
authored
Update readme and gitignore (#8)
1 parent 096ff9a commit dfe872c

File tree

2 files changed

+227
-1
lines changed

2 files changed

+227
-1
lines changed

.gitignore

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,191 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
114
go.work.sum
15+
16+
.vscode/*
17+
!.vscode/settings.json
18+
!.vscode/tasks.json
19+
!.vscode/launch.json
20+
!.vscode/extensions.json
21+
!.vscode/*.code-snippets
22+
23+
# Local History for Visual Studio Code
24+
.history/
25+
26+
# Built Visual Studio Code Extensions
27+
*.vsix
28+
29+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
30+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
31+
32+
# User-specific stuff
33+
.idea/**/workspace.xml
34+
.idea/**/tasks.xml
35+
.idea/**/usage.statistics.xml
36+
.idea/**/dictionaries
37+
.idea/**/shelf
38+
39+
# AWS User-specific
40+
.idea/**/aws.xml
41+
42+
# Generated files
43+
.idea/**/contentModel.xml
44+
45+
# Sensitive or high-churn files
46+
.idea/**/dataSources/
47+
.idea/**/dataSources.ids
48+
.idea/**/dataSources.local.xml
49+
.idea/**/sqlDataSources.xml
50+
.idea/**/dynamic.xml
51+
.idea/**/uiDesigner.xml
52+
.idea/**/dbnavigator.xml
53+
54+
# Gradle
55+
.idea/**/gradle.xml
56+
.idea/**/libraries
57+
58+
# Gradle and Maven with auto-import
59+
# When using Gradle or Maven with auto-import, you should exclude module files,
60+
# since they will be recreated, and may cause churn. Uncomment if using
61+
# auto-import.
62+
# .idea/artifacts
63+
# .idea/compiler.xml
64+
# .idea/jarRepositories.xml
65+
# .idea/modules.xml
66+
# .idea/*.iml
67+
# .idea/modules
68+
# *.iml
69+
# *.ipr
70+
71+
# CMake
72+
cmake-build-*/
73+
74+
# Mongo Explorer plugin
75+
.idea/**/mongoSettings.xml
76+
77+
# File-based project format
78+
*.iws
79+
80+
# IntelliJ
81+
out/
82+
83+
# mpeltonen/sbt-idea plugin
84+
.idea_modules/
85+
86+
# JIRA plugin
87+
atlassian-ide-plugin.xml
88+
89+
# Cursive Clojure plugin
90+
.idea/replstate.xml
91+
92+
# SonarLint plugin
93+
.idea/sonarlint/
94+
95+
# Crashlytics plugin (for Android Studio and IntelliJ)
96+
com_crashlytics_export_strings.xml
97+
crashlytics.properties
98+
crashlytics-build.properties
99+
fabric.properties
100+
101+
# Editor-based Rest Client
102+
.idea/httpRequests
103+
104+
# Android studio 3.1+ serialized cache file
105+
.idea/caches/build_file_checksums.ser
106+
107+
# Swap
108+
[._]*.s[a-v][a-z]
109+
!*.svg # comment out if you don't need vector files
110+
[._]*.sw[a-p]
111+
[._]s[a-rt-v][a-z]
112+
[._]ss[a-gi-z]
113+
[._]sw[a-p]
114+
115+
# Session
116+
Session.vim
117+
Sessionx.vim
118+
119+
# Temporary
120+
.netrwhist
121+
*~
122+
# Auto-generated tag files
123+
tags
124+
# Persistent undo
125+
[._]*.un~
126+
127+
# Windows thumbnail cache files
128+
Thumbs.db
129+
Thumbs.db:encryptable
130+
ehthumbs.db
131+
ehthumbs_vista.db
132+
133+
# Dump file
134+
*.stackdump
135+
136+
# Folder config file
137+
[Dd]esktop.ini
138+
139+
# Recycle Bin used on file shares
140+
$RECYCLE.BIN/
141+
142+
# Windows Installer files
143+
*.cab
144+
*.msi
145+
*.msix
146+
*.msm
147+
*.msp
148+
149+
# Windows shortcuts
150+
*.lnk
151+
152+
# General
153+
.DS_Store
154+
.AppleDouble
155+
.LSOverride
156+
157+
# Icon must end with two \r
158+
Icon
159+
160+
# Thumbnails
161+
._*
162+
163+
# Files that might appear in the root of a volume
164+
.DocumentRevisions-V100
165+
.fseventsd
166+
.Spotlight-V100
167+
.TemporaryItems
168+
.Trashes
169+
.VolumeIcon.icns
170+
.com.apple.timemachine.donotpresent
171+
172+
# Directories potentially created on remote AFP share
173+
.AppleDB
174+
.AppleDesktop
175+
Network Trash Folder
176+
Temporary Items
177+
.apdisk
178+
179+
*~
180+
181+
# temporary files which can be created if a process still has a handle open of a deleted file
182+
.fuse_hidden*
183+
184+
# KDE directory preferences
185+
.directory
186+
187+
# Linux trash folder which might appear on any partition or disk
188+
.Trash-*
189+
190+
# .nfs files are created when an open file is removed but is still being accessed
191+
.nfs*

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ go install github.com/ckaznocha/intrange/cmd/intrange@latest
1919
go vet -vettool=$(which intrange) ./...
2020
```
2121

22-
## Example
22+
## Examples
23+
24+
### A loop that uses the value of the loop variable
2325

2426
```go
2527
package main
@@ -52,3 +54,37 @@ func main() {
5254
}
5355
}
5456
```
57+
58+
### A loop that does not use the value of the loop variable
59+
60+
```go
61+
package main
62+
63+
import "fmt"
64+
65+
func main() {
66+
for i := 0; i < 10; i++ {
67+
fmt.Println("Hello again!")
68+
}
69+
}
70+
```
71+
72+
Running `intrange` on the above code will produce the following output:
73+
74+
```bash
75+
main.go:5:2: for loop can be changed to use an integer range (Go 1.22+)
76+
```
77+
78+
The loop can be rewritten as:
79+
80+
```go
81+
package main
82+
83+
import "fmt"
84+
85+
func main() {
86+
for range 10 {
87+
fmt.Println("Hello again!")
88+
}
89+
}
90+
```

0 commit comments

Comments
 (0)