You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2020/01/28 17:26:05 UTC

[mynewt-newt] 01/09: Remove unused function (LocalPackage*).Hash

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit f8d0ab7885414bb94d9d5177c57d6ff3dbeacc32
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Jan 27 10:42:53 2020 -0800

    Remove unused function (LocalPackage*).Hash
---
 newt/pkg/localpackage.go | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/newt/pkg/localpackage.go b/newt/pkg/localpackage.go
index 47a52a4..9db822f 100644
--- a/newt/pkg/localpackage.go
+++ b/newt/pkg/localpackage.go
@@ -21,9 +21,7 @@ package pkg
 
 import (
 	"bytes"
-	"crypto/sha1"
 	"fmt"
-	"io/ioutil"
 	"os"
 	"path/filepath"
 	"strings"
@@ -157,38 +155,6 @@ func (pkg *LocalPackage) SetRepo(r *repo.Repo) {
 	pkg.repo = r
 }
 
-func (pkg *LocalPackage) Hash() (string, error) {
-	hash := sha1.New()
-
-	err := filepath.Walk(pkg.basePath,
-		func(path string, info os.FileInfo, err error) error {
-			name := info.Name()
-			if PackageHashIgnoreDirs[name] {
-				return filepath.SkipDir
-			}
-
-			if info.IsDir() {
-				// SHA the directory name into the hash
-				hash.Write([]byte(name))
-			} else {
-				// SHA the file name & contents into the hash
-				contents, err := ioutil.ReadFile(path)
-				if err != nil {
-					return err
-				}
-				hash.Write(contents)
-			}
-			return nil
-		})
-	if err != nil && err != filepath.SkipDir {
-		return "", util.NewNewtError(err.Error())
-	}
-
-	hashStr := fmt.Sprintf("%x", hash.Sum(nil))
-
-	return hashStr, nil
-}
-
 func (pkg *LocalPackage) CfgFilenames() []string {
 	return pkg.cfgFilenames
 }