From 66d1735e42c856a72277827b4f0630b67e1d8dcd Mon Sep 17 00:00:00 2001 From: Steffen Fritz Date: Tue, 22 Feb 2022 22:44:22 +0100 Subject: [PATCH] error refactoring. Close #13. --- .idea/workspace.xml | 114 ++++++++++++++++++++++++++++++++ Makefile | 6 +- README.md | 4 +- cmd/gobagit/gobagit.1 | 31 +++++---- cmd/gobagit/main.go | 37 ++++++----- copy.go | 27 ++++++-- create.go | 149 +++++++++++++++++++++++++++++++++--------- err.go | 10 --- go.mod | 1 + go.sum | 2 + hash.go | 15 ++++- tarit.go | 12 ++-- types.go | 1 + validate.go | 61 +++++++++++++---- 14 files changed, 367 insertions(+), 103 deletions(-) create mode 100644 .idea/workspace.xml delete mode 100644 err.go diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..dac45db --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + \ No newline at end of file diff --git a/Makefile b/Makefile index 208e8e7..b242c1b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ -all: - go build test: go test -v rm -rf testdata/bag_golden -prod: - go build -ldflags "-w -s" + +.PHONY: test \ No newline at end of file diff --git a/README.md b/README.md index b83fb35..b04f05b 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ Wikipedia: [https://en.wikipedia.org/wiki/BagIt](https://en.wikipedia.org/wiki/B IETF: [https://tools.ietf.org/html/rfc8493](https://tools.ietf.org/html/rfc8493) -[![Build Status](https://travis-ci.org/steffenfritz/bagit.svg?branch=master)](https://travis-ci.org/steffenfritz/bagit) +[![Build status](https://ci.appveyor.com/api/projects/status/vscholjbph8umbd3?svg=true)](https://ci.appveyor.com/project/steffenfritz/bagit) [![codecov](https://codecov.io/gh/steffenfritz/bagit/branch/master/graph/badge.svg)](https://codecov.io/gh/steffenfritz/bagit) [![Go Report Card](https://goreportcard.com/badge/github.com/steffenfritz/bagit)](https://goreportcard.com/report/github.com/steffenfritz/bagit) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=steffenfritz_bagit&metric=alert_status)](https://sonarcloud.io/dashboard?id=steffenfritz_bagit) -Version: 0.4.0 +Version: 0.5.0 # Usage examples diff --git a/cmd/gobagit/gobagit.1 b/cmd/gobagit/gobagit.1 index acb619d..98a2014 100644 --- a/cmd/gobagit/gobagit.1 +++ b/cmd/gobagit/gobagit.1 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2019, Steffen Fritz +.\" Copyright (c) 2019-2022, Steffen Fritz .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or @@ -21,7 +21,7 @@ .\" . .\" %%%LICENSE_END -.TH gobagit 1 "July 2019" "version 0.4.0" +.TH gobagit 1 "March 2022" "version 0.5.0" .SH NAME gobagit .SH SYNOPSIS @@ -37,39 +37,38 @@ Bags are ideal for digital content normally kept as a collection of files. They .SH FLAGS -.BR \-create\fR +.BR \--create,\ -C\fR Create bag. Expects path to source directory -.BR \-fetch\fR +.BR \--fetch,\ -F\fR Adds optional fetch file to bag. Expects path to fetch.txt file and flag manifetch -.BR \-hash\fR +.BR \--hash,\ -H\fR Hash algorithm used for manifest file when creating a bag -.BR \-header\fR +.BR \--header,\ -J\fR Additional headers for bag-info.txt. Expects path to json file -.BR \-manifetch\fR +.BR \--manifetch,\ -M\fR Path to manifest file for optional fetch.txt file. Mandatory if fetch switch is used -.BR \-output\fR +.BR \--output,\ -O\fR Output directory for bag. Used with create flag -.BR \-tagmanifest\fR +.BR \--tagmanifest,\ -t\fR Hash algorithm used for tag manifest file -.BR \-tar\fR +.BR \--tar,\ -T\fR Create a tar archive when creating a bag -.BR \-v\fR - Verbose output - -.BR \-validate\fR +.BR \--validate,\ -V\fR Validate bag. Expects path to bag -.BR \-version\fR - Print version +.BR \--verbose,\ -v\fR + Verbose output +.BR \--version\fR + Print version .SH AUTHOR diff --git a/cmd/gobagit/main.go b/cmd/gobagit/main.go index beb2d4d..a6dd16d 100644 --- a/cmd/gobagit/main.go +++ b/cmd/gobagit/main.go @@ -1,37 +1,38 @@ package main import ( - "flag" "log" "os" "time" + flag "github.com/spf13/pflag" "github.com/steffenfritz/bagit" ) -const version = "0.4.0" +var Version string +var Build string var starttime = time.Now().Format("2006-01-02T150405") func main() { b := bagit.New() - vers := flag.Bool("version", false, "Print version") - validate := flag.String("validate", "", "Validate bag. Expects path to bag") - b.SrcDir = flag.String("create", "", "Create bag. Expects path to source directory") - b.OutDir = flag.String("output", "bag_"+starttime, "Output directory for bag. Used with create flag") - tarit := flag.Bool("tar", false, "Create a tar archive when creating a bag") - b.HashAlg = flag.String("hash", "sha512", "Hash algorithm used for manifest file when creating a bag [sha1, sha256, sha512, md5]") - verbose := flag.Bool("v", false, "Verbose output") - b.AddHeader = flag.String("header", "", "Additional headers for bag-info.txt. Expects path to json file") - b.FetchFile = flag.String("fetch", "", "Adds optional fetch file to bag. Expects path to fetch.txt file and switch manifetch") - b.FetchManifest = flag.String("manifetch", "", "Path to manifest file for optional fetch.txt file. Mandatory if fetch switch is used") - b.TagManifest = flag.String("tagmanifest", "", "Hash algorithm used for tag manifest file [sha1, sha256, sha512, md5]") + vers := flag.BoolP("version", "", false, "Print version") + validate := flag.StringP("validate", "V", "", "Validate bag. Expects path to bag") + b.SrcDir = flag.StringP("create", "C", "", "Create bag. Expects path to source directory") + b.OutDir = flag.StringP("output", "O", "bag_"+starttime, "Output directory for bag. Used with create flag") + tarit := flag.BoolP("tar", "T", false, "Create a tar archive when creating a bag") + b.HashAlg = flag.StringP("hash", "H", "sha512", "Hash algorithm used for manifest file when creating a bag [sha1, sha256, sha512, md5]") + verbose := flag.BoolP("verbose", "v", false, "Verbose output") + b.AddHeader = flag.StringP("header", "J", "", "Additional headers for bag-info.txt. Expects path to json file") + b.FetchFile = flag.StringP("fetch", "F", "", "Adds optional fetch file to bag. Expects path to fetch.txt file and switch manifetch") + b.FetchManifest = flag.StringP("manifetch", "M", "", "Path to manifest file for optional fetch.txt file. Mandatory if fetch switch is used") + b.TagManifest = flag.StringP("tagmanifest", "t", "", "Hash algorithm used for tag manifest file [sha1, sha256, sha512, md5]") flag.Parse() if *vers { - log.Println("Version: " + version) + log.Println("Version: " + Version + " Build: " + Build) return } @@ -98,10 +99,14 @@ func main() { b.Oxum.Bytes = int64(fetchoxumbytes) b.Oxum.Filecount = fetchoxumfiles - b.Create(*verbose) + err = b.Create(*verbose) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if *tarit { - b.Tarit(*b.OutDir, *b.OutDir+".tar.gz") + err = b.Tarit(*b.OutDir, *b.OutDir+".tar.gz") + log.Fatalf("ERROR: %s", err.Error()) } return diff --git a/copy.go b/copy.go index 237468c..56f3ea5 100644 --- a/copy.go +++ b/copy.go @@ -3,24 +3,41 @@ package bagit import ( "fmt" "io" + "log" "os" ) func copy(src, dst string) (int64, error) { sourceFileStat, err := os.Stat(src) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if !sourceFileStat.Mode().IsRegular() { return 0, fmt.Errorf("%s is not a regular file", src) } source, err := os.Open(src) - e(err) - defer source.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(source *os.File) { + err := source.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(source) destination, err := os.Create(dst) - e(err) - defer destination.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(destination *os.File) { + err := destination.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(destination) nBytes, err := io.Copy(destination, source) return nBytes, err diff --git a/create.go b/create.go index cd34d49..061c9af 100644 --- a/create.go +++ b/create.go @@ -38,7 +38,9 @@ func (b *Bagit) Create(verbose bool) error { // create bagit directory err = os.Mkdir(*b.OutDir, 0700) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if verbose { log.Println("Created output dir:\t" + *b.OutDir) @@ -46,17 +48,30 @@ func (b *Bagit) Create(verbose bool) error { // create payload dir err = os.Mkdir(*b.OutDir+"/data", 0700) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } // create bagit.txt tag file fd, err := os.Create(*b.OutDir + "/bagit.txt") - e(err) - defer fd.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(fd *os.File) { + err := fd.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(fd) _, err = fd.WriteString("BagIt-Version: " + BagitVer + "\n") - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } _, err = fd.WriteString("Tag-File-Character-Encoding: " + TagFileCharEnc) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if verbose { log.Println("Created bagit.txt file") @@ -64,61 +79,113 @@ func (b *Bagit) Create(verbose bool) error { // create manifest-ALG.txt file fm, err := os.Create(*b.OutDir + "/manifest-" + *b.HashAlg + ".txt") - e(err) - defer fm.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(fm *os.File) { + err := fm.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(fm) // create bag-info.txt file fi, err := os.Create(*b.OutDir + "/bag-info.txt") - e(err) - defer fi.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(fi *os.File) { + err := fi.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(fi) // copy source to data dir in new bag, calculate oxum and count bytes of payload err = filepath.Walk(*b.SrcDir, func(path string, info os.FileInfo, err error) error { if !info.IsDir() { b.Oxum.Filecount++ fsize, err := os.Stat(path) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } b.Oxum.Bytes += fsize.Size() // normalizing path separators + // ToDo: Issue https://github.com/steffenfritz/bagit/issues/11 normpath := strings.Replace(path, string(os.PathSeparator), "/", -1) //_, err = fm.WriteString(hex.EncodeToString(hashit(path, *b.HashAlg)) + " data/" + path + "\n") _, err = fm.WriteString(hex.EncodeToString(hashit(path, *b.HashAlg)) + " data/" + normpath + "\n") - copy(path, *b.OutDir+"/data/"+path) + _, cperr := copy(path, *b.OutDir+"/data/"+path) + if cperr != nil { + log.Fatalf("ERROR: %s", err.Error()) + } } else { - os.MkdirAll(*b.OutDir+"/data/"+path, 0700) + err := os.MkdirAll(*b.OutDir+"/data/"+path, 0700) + if err != nil { + log.Fatalf("ERROR: %s", err) + } } return nil }) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } // import fetch.txt file and concat provided manifest file to created manifest file if len(*b.FetchFile) != 0 { // check if file exists _, err = os.Stat(*b.FetchFile) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } // copy fetch file to bag src, err := os.Open(*b.FetchFile) - e(err) - defer src.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(src *os.File) { + err := src.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(src) dst, err := os.Create(*b.OutDir + "/fetch.txt") - e(err) - defer dst.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(dst *os.File) { + err := dst.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(dst) _, err = io.Copy(dst, src) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if verbose { log.Println("Copied fetch.txt file to bag") } fmn, err := os.Open(*b.FetchManifest) - e(err) - defer fmn.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(fmn *os.File) { + err := fmn.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(fmn) _, err = io.Copy(fm, fmn) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } } @@ -149,16 +216,28 @@ func (b *Bagit) Create(verbose bool) error { // create tag manifest if len(*b.TagManifest) != 0 { ftm, err := os.Create(*b.OutDir + "/tagmanifest-" + *b.TagManifest + ".txt") - e(err) - defer ftm.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(ftm *os.File) { + err := ftm.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(ftm) fileList, err := ioutil.ReadDir(*b.OutDir) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } for _, file := range fileList { if !file.IsDir() { if !strings.HasPrefix(file.Name(), "tagmanifest-") { - ftm.WriteString(hex.EncodeToString(hashit(*b.OutDir+"/"+file.Name(), *b.TagManifest)) + " " + file.Name() + "\n") + _, wrerr := ftm.WriteString(hex.EncodeToString(hashit(*b.OutDir+"/"+file.Name(), *b.TagManifest)) + " " + file.Name() + "\n") + if wrerr != nil { + return wrerr + } } } } @@ -170,13 +249,23 @@ func (b *Bagit) Create(verbose bool) error { // getaddHeader gets additional headers from a json file func getaddHeader(addHeader string) map[string]interface{} { jsonFile, err := os.Open(addHeader) - e(err) - defer jsonFile.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(jsonFile *os.File) { + err := jsonFile.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(jsonFile) byteValue, _ := ioutil.ReadAll(jsonFile) var result map[string]interface{} - json.Unmarshal([]byte(byteValue), &result) + err = json.Unmarshal(byteValue, &result) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } return result } diff --git a/err.go b/err.go deleted file mode 100644 index 75d3ed8..0000000 --- a/err.go +++ /dev/null @@ -1,10 +0,0 @@ -package bagit - -import "log" - -// e is just a shorty for generic errors and panics -func e(err error) { - if err != nil { - log.Panicln(err) - } -} diff --git a/go.mod b/go.mod index 1bf2718..258594a 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/mholt/archiver v3.1.1+incompatible github.com/nwaples/rardecode v1.1.0 // indirect github.com/pierrec/lz4 v2.5.2+incompatible // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/ulikunitz/xz v0.5.8 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect ) diff --git a/go.sum b/go.sum index 16c7b14..846d174 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,8 @@ github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWk github.com/pierrec/lz4 v1.0.1 h1:w6GMGWSsCI04fTM8wQRdnW74MuJISakuUU0onU0TYB4= github.com/pierrec/lz4 v2.5.2+incompatible h1:WCjObylUIOlKy/+7Abdn34TLIkXiA4UWUMhxq9m9ZXI= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= diff --git a/hash.go b/hash.go index 6d2d029..fe2247b 100644 --- a/hash.go +++ b/hash.go @@ -13,8 +13,15 @@ import ( func hashit(inFile string, hashalg string) []byte { fd, err := os.Open(inFile) - e(err) - defer fd.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(fd *os.File) { + err := fd.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(fd) var hasher hash.Hash @@ -36,7 +43,9 @@ func hashit(inFile string, hashalg string) []byte { } _, err = io.Copy(hasher, fd) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } checksum := hasher.Sum(nil) diff --git a/tarit.go b/tarit.go index db748e6..408f52c 100644 --- a/tarit.go +++ b/tarit.go @@ -2,18 +2,22 @@ package bagit import ( "github.com/mholt/archiver" + "log" ) // Tarit tars a directory func (b *Bagit) Tarit(srcDir string, outFile string) error { - - tarbag(srcDir, outFile) + err := tarbag(srcDir, outFile) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } return nil } func tarbag(src string, outarc string) error { - err := archiver.Archive([]string{src}, outarc) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } return err } diff --git a/types.go b/types.go index 111de1f..cf80095 100644 --- a/types.go +++ b/types.go @@ -4,6 +4,7 @@ import ( "crypto" ) +//goland:noinspection GoNameStartsWithPackageName const ( // BagitVer is the version of the bagit spec this library coresponds to BagitVer = "1.0" diff --git a/validate.go b/validate.go index df0a785..6209187 100644 --- a/validate.go +++ b/validate.go @@ -42,7 +42,9 @@ func (b *Bagit) Validate(srcDir string, verbose bool) (bool, error) { } return err }) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if !hashset { log.Println("No manifest file found") @@ -65,8 +67,15 @@ func (b *Bagit) Validate(srcDir string, verbose bool) (bool, error) { log.Println(" Found bag-info.txt") } fd, err := os.Open(srcDir + string(os.PathSeparator) + "bag-info.txt") - e(err) - defer fd.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(fd *os.File) { + err := fd.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(fd) scanner := bufio.NewScanner(fd) for scanner.Scan() { if strings.HasPrefix(scanner.Text(), "Payload-Oxum:") { @@ -81,8 +90,15 @@ func (b *Bagit) Validate(srcDir string, verbose bool) (bool, error) { } fm, err := os.Open(manifestfile) - e(err) - defer fm.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(fm *os.File) { + err := fm.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(fm) // checking if all files are present that are listed in payload manifest filescanner := bufio.NewScanner(fm) @@ -106,7 +122,9 @@ func (b *Bagit) Validate(srcDir string, verbose bool) (bool, error) { if !info.IsDir() { b.Oxum.Filecount++ fsize, err := os.Stat(path) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } b.Oxum.Bytes += fsize.Size() comppath := strings.SplitN(path, string(os.PathSeparator)+"data"+string(os.PathSeparator), 2) @@ -114,7 +132,11 @@ func (b *Bagit) Validate(srcDir string, verbose bool) (bool, error) { normcompath := strings.Replace(comppath[1], string(os.PathSeparator), "/", -1) scanner := bufio.NewScanner(fm) - fm.Seek(0, 0) + _, err = fm.Seek(0, 0) + if err != nil { + // ToDo: This should probably be a fatal one + log.Printf("WARNING: %s", err.Error()) + } if verbose { log.Println(" Hashing " + path) @@ -140,10 +162,12 @@ func (b *Bagit) Validate(srcDir string, verbose bool) (bool, error) { } return nil }) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if checkoxum { - oxumcalculated := strconv.Itoa(int(b.Oxum.Bytes)) + "." + strconv.Itoa(int(b.Oxum.Filecount)) + oxumcalculated := strconv.Itoa(int(b.Oxum.Bytes)) + "." + strconv.Itoa(b.Oxum.Filecount) if oxumcalculated != oxumread { if verbose { @@ -174,7 +198,9 @@ func ValidateFetchFile(inFetch string, verbose bool) (bool, bool, int, int) { oxumfiles := 0 ff, err := os.Open(inFetch) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } scanner := bufio.NewScanner(ff) for scanner.Scan() { fetchuri := strings.Fields(scanner.Text())[0] @@ -223,8 +249,15 @@ func ValidateTagmanifests(srcDir *string, tagmanifests *[]string, verbose bool, for _, tmentry := range *tagmanifests { //tmpfd, err := os.Open(*srcDir + string(os.PathSeparator) + tmentry) tmpfd, err := os.Open(*srcDir + tmentry) - e(err) - defer tmpfd.Close() + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } + defer func(tmpfd *os.File) { + err := tmpfd.Close() + if err != nil { + log.Printf("WARNING: %s", err.Error()) + } + }(tmpfd) tmphashalg := strings.Split(strings.Split(tmentry, "-")[1], ".")[0] if verbose { @@ -235,7 +268,9 @@ func ValidateTagmanifests(srcDir *string, tagmanifests *[]string, verbose bool, for scanner.Scan() { tmptagfile := strings.Split(scanner.Text(), " ")[1] tmptagstat, err := os.Lstat(*srcDir + string(os.PathSeparator) + tmptagfile) - e(err) + if err != nil { + log.Fatalf("ERROR: %s", err.Error()) + } if !tmptagstat.IsDir() { if verbose {