Skip to content

Commit 74e1292

Browse files
Fix binary error (#7)
* update and lint main.go * implement fix for error where goignore cannot find the gitignore templates file * test binary
1 parent 86cb67c commit 74e1292

File tree

10 files changed

+43
-3
lines changed

10 files changed

+43
-3
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@
1616

1717
# Dependency directories (remove the comment below to include it)
1818
# vendor/
19+
20+
# env
21+
.env
22+
.env.local
23+
24+
# macOS specific files
25+
.DS_Store
26+
profile

cmd/goignore/.DS_Store

6 KB
Binary file not shown.

cmd/goignore/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package main
33

44
import (
5+
"embed"
56
"fmt"
67
"os"
78
"os/exec"
@@ -160,9 +161,12 @@ func main() {
160161
}
161162
}
162163

164+
//go:embed templates/*.txt
165+
var templateFiles embed.FS
166+
163167
func readTemplateFile(language string) (string, error) {
164-
templatePath := fmt.Sprintf("./templates/%s.txt", language)
165-
content, err := os.ReadFile(templatePath)
168+
templatePath := fmt.Sprintf("templates/%s.txt", language)
169+
content, err := templateFiles.ReadFile(templatePath)
166170
if err != nil {
167171
return "", err
168172
}

cmd/goignore/templates/c.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ modules.order
5050
Module.symvers
5151
Mkfile.old
5252
dkms.conf
53+
54+
# macOS specific files
55+
.DS_Store
56+
profile

cmd/goignore/templates/golang.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@
1919

2020
# env
2121
.env
22-
.env.local
22+
.env.local
23+
24+
# macOS specific files
25+
.DS_Store
26+
profile

cmd/goignore/templates/haskell.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ cabal.project.local
2121
cabal.project.local~
2222
.HTF/
2323
.ghc.environment.*
24+
25+
# macOS specific files
26+
.DS_Store
27+
profile

cmd/goignore/templates/javascript.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@
1717
npm-debug.log*
1818
yarn-debug.log*
1919
yarn-error.log*
20+
21+
# macOS specific files
22+
.DS_Store
23+
profile

cmd/goignore/templates/python.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ celerybeat-schedule
6666
# env
6767
.env
6868
.env.local
69+
70+
# macOS specific files
71+
.DS_Store
72+
profile

cmd/goignore/templates/ruby.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@ build-iPhoneSimulator/
5454

5555
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
5656
# .rubocop-https?--*
57+
58+
# macOS specific files
59+
.DS_Store
60+
profile

cmd/goignore/templates/rust.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ Cargo.lock
1212

1313
# MSVC Windows builds of rustc generate these, which store debugging information
1414
*.pdb
15+
16+
# macOS specific files
17+
.DS_Store
18+
profile

0 commit comments

Comments
 (0)