Removing check function and checking for error in usual way

This commit is contained in:
Sridhar Ganesan 2018-07-18 08:01:49 +02:00
parent 1da8b25847
commit c2e5734c0b
1 changed files with 3 additions and 7 deletions

View File

@ -26,12 +26,6 @@ func resolveProjectPath(remoteProjectPath string) string {
return gopath + string(os.PathSeparator) + "src" + string(os.PathSeparator) + remoteProjectPath
}
func check(e error) {
if e != nil {
panic(e)
}
}
var remoteBasecoinPath = "github.com/cosmos/cosmos-sdk/examples/basecoin"
func copyBasecoinTemplate(projectName string, projectPath string, remoteProjectPath string) {
@ -39,7 +33,9 @@ func copyBasecoinTemplate(projectName string, projectPath string, remoteProjectP
filepath.Walk(basecoinProjectPath, func(path string, f os.FileInfo, err error) error {
if !f.IsDir() {
data, err := ioutil.ReadFile(path)
check(err)
if err != nil {
return err
}
contents := string(data)
// Extract relative file path eg: app/app.go instead of /Users/..../github.com/cosmos/...examples/basecoin/app/app.go
relativeFilePath := path[len(basecoinProjectPath)+1:]