Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filet.CleanUp(t) does not work on Windows #4

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Binaries for programs and plugins
bin/

# package dependencies file generated by `dep ensure` command
Gopkg.lock

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
vendor/

# app log files
*.log

# Editors
# PyCharm
.idea
# VIM
*~
*.swp
*.swo
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
.history/

# Git
*.orig
38 changes: 38 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/spf13/afero"
version = "1.4.1"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.6.1"

[prune]
go-tests = true
unused-packages = true
3 changes: 3 additions & 0 deletions filet.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ TmpFile Creates a tmp file for us to use when testing
*/
func TmpFile(t TestReporter, dir string, content string) afero.File {
file, err := afero.TempFile(appFs, dir, "file")
defer file.Close()

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

if err != nil {
t.Error("Failed to create the file: "+path, err)
return nil
Expand Down