Skip to content

Commit 24faeb1

Browse files
author
Bart Grzybicki
committedOct 6, 2020
add file close to TmpFile and File, add .gitignore, add package deps
1 parent fc4d33c commit 24faeb1

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed
 

‎.gitignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Binaries for programs and plugins
2+
bin/
3+
4+
# package dependencies file generated by `dep ensure` command
5+
Gopkg.lock
6+
7+
# Test binary, built with `go test -c`
8+
*.test
9+
10+
# Output of the go coverage tool, specifically when used with LiteIDE
11+
*.out
12+
13+
# Dependency directories (remove the comment below to include it)
14+
vendor/
15+
16+
# app log files
17+
*.log
18+
19+
# Editors
20+
# PyCharm
21+
.idea
22+
# VIM
23+
*~
24+
*.swp
25+
*.swo
26+
# Visual Studio Code
27+
.vscode/*
28+
!.vscode/settings.json
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
31+
!.vscode/extensions.json
32+
*.code-workspace
33+
.history/
34+
35+
# Git
36+
*.orig

‎Gopkg.toml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Gopkg.toml example
2+
#
3+
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
4+
# for detailed Gopkg.toml documentation.
5+
#
6+
# required = ["github.com/user/thing/cmd/thing"]
7+
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8+
#
9+
# [[constraint]]
10+
# name = "github.com/user/project"
11+
# version = "1.0.0"
12+
#
13+
# [[constraint]]
14+
# name = "github.com/user/project2"
15+
# branch = "dev"
16+
# source = "github.com/myfork/project2"
17+
#
18+
# [[override]]
19+
# name = "github.com/x/y"
20+
# version = "2.4.0"
21+
#
22+
# [prune]
23+
# non-go = false
24+
# go-tests = true
25+
# unused-packages = true
26+
27+
28+
[[constraint]]
29+
name = "github.com/spf13/afero"
30+
version = "1.4.1"
31+
32+
[[constraint]]
33+
name = "github.com/stretchr/testify"
34+
version = "1.6.1"
35+
36+
[prune]
37+
go-tests = true
38+
unused-packages = true

‎filet.go

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ TmpFile Creates a tmp file for us to use when testing
3434
*/
3535
func TmpFile(t TestReporter, dir string, content string) afero.File {
3636
file, err := afero.TempFile(appFs, dir, "file")
37+
defer file.Close()
3738

3839
if err != nil {
3940
t.Error("Failed to create the tmpFile: "+file.Name(), err)
@@ -50,6 +51,8 @@ File Creates a specified file for us to use when testing
5051
*/
5152
func File(t TestReporter, path string, content string) afero.File {
5253
file, err := appFs.OpenFile(path, os.O_RDWR|os.O_CREATE, 0600)
54+
defer file.Close()
55+
5356
if err != nil {
5457
t.Error("Failed to create the file: "+path, err)
5558
return nil

0 commit comments

Comments
 (0)
Please sign in to comment.