Do not include v1/legacy in coverage

for/master
Dustin Oprea 2020-01-11 18:04:45 -05:00
parent 25524615d1
commit ebd20ffc59
2 changed files with 15 additions and 8 deletions

View File

@ -12,4 +12,9 @@ install:
- go get -t ./...
- go get github.com/mattn/goveralls
script:
- goveralls -v -service=travis-ci
# Don't test recursively, so we stay within v1/legacy.
- go test -v github.com/dsoprea/go-exif
- go test -v github.com/dsoprea/go-exif/exif-read-tool
# Coverage is based on v2.
- cd v2
- EXIF_MODULE_ROOT_PATH="$(pwd)" goveralls -v -service=travis-ci

View File

@ -24,6 +24,11 @@ var (
)
func GetModuleRootPath() string {
moduleRootPath := os.Getenv("EXIF_MODULE_ROOT_PATH")
if moduleRootPath != "" {
return moduleRootPath
}
currentWd, err := os.Getwd()
log.PanicIf(err)
@ -33,14 +38,11 @@ func GetModuleRootPath() string {
for {
tryStampFilepath := path.Join(currentPath, ".MODULE_ROOT")
f, err := os.Open(tryStampFilepath)
if err == nil {
f.Close()
break
}
if err.Error() != "No such file or directory" {
_, err := os.Stat(tryStampFilepath)
if err != nil && os.IsNotExist(err) != true {
log.Panic(err)
} else if err == nil {
break
}
visited = append(visited, tryStampFilepath)