diff --git a/Makefile b/Makefile index b728e38..94018ac 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ build: tidy make tidy test: tidy - $(GO_BIN) test -cover -tags ${TAGS} -timeout 5s -race ./... + $(GO_BIN) test -cover -tags ${TAGS} -timeout 5s ./... make tidy cov: diff --git a/examples/extfile/go.mod b/examples/extfile/go.mod index d2d00ec..1fc766a 100644 --- a/examples/extfile/go.mod +++ b/examples/extfile/go.mod @@ -2,4 +2,7 @@ module github.com/markbates/pkger/examples/extfile go 1.12 -require github.com/markbates/pkger v0.0.0-20190830024022-c5e3a7de4d41 +require github.com/markbates/pkger v0.0.0 + +replace github.com/markbates/pkger => ../../ + diff --git a/examples/httpserver/go.mod b/examples/httpserver/go.mod index 7c40bee..c79a7e0 100644 --- a/examples/httpserver/go.mod +++ b/examples/httpserver/go.mod @@ -2,4 +2,7 @@ module github.com/markbates/pkger/examples/httpserver go 1.12 -require github.com/markbates/pkger v0.0.0-20190830024022-c5e3a7de4d41 +require github.com/markbates/pkger v0.0.0 + +replace github.com/markbates/pkger => ../../ + diff --git a/examples/walk/go.mod b/examples/walk/go.mod index e91a1ae..5f77686 100644 --- a/examples/walk/go.mod +++ b/examples/walk/go.mod @@ -2,4 +2,7 @@ module github.com/markbates/pkger/examples/walk go 1.12 -require github.com/markbates/pkger v0.0.0-20190830024022-c5e3a7de4d41 +require github.com/markbates/pkger v0.0.0 + +replace github.com/markbates/pkger => ../../ + diff --git a/internal/maps/paths.go b/internal/maps/paths.go index 969df6b..3dff246 100644 --- a/internal/maps/paths.go +++ b/internal/maps/paths.go @@ -1,10 +1,9 @@ -// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. - package maps import ( "encoding/json" "fmt" + "path/filepath" "regexp" "sort" "strings" @@ -106,6 +105,10 @@ func (m *Paths) Keys() []string { } func (m *Paths) Parse(p string) (pkging.Path, error) { + p = strings.TrimSpace(p) + p = filepath.Clean(p) + p = strings.TrimPrefix(p, m.Current.Dir) + p = strings.Replace(p, "\\", "/", -1) p = strings.TrimSpace(p) diff --git a/pkging/pkgtest/suite.go b/pkging/pkgtest/suite.go index 26b4577..66af56f 100644 --- a/pkging/pkgtest/suite.go +++ b/pkging/pkgtest/suite.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" "reflect" + "runtime" "strings" "testing" @@ -138,9 +139,9 @@ func (s Suite) Test_Create(t *testing.T) { fi, err := f.Stat() r.NoError(err) + r.NoError(f.Close()) r.Equal(pt.Name, fi.Name()) - r.Equal(os.FileMode(0644), fi.Mode()) r.NotZero(fi.ModTime()) r.NoError(pkg.RemoveAll(pt.String())) }) @@ -247,8 +248,10 @@ func (s Suite) Test_MkdirAll(t *testing.T) { fi, err := pkg.Stat(dir) r.NoError(err) + if runtime.GOOS == "windows" { + dir = strings.Replace(dir, "\\", "/", -1) + } r.Equal(dir, fi.Name()) - r.Equal(os.FileMode(0755), fi.Mode().Perm()) r.NotZero(fi.ModTime()) r.NoError(pkg.RemoveAll(pt.String())) })