fix(style): cleanup coding style on error returns

pull/760/head
Adam Reese 9 years ago
parent b1e0c8fc38
commit a19875adcc

@ -55,9 +55,6 @@ func runCreate(cmd *cobra.Command, args []string) error {
Version: "0.1.0", Version: "0.1.0",
} }
if _, err := chart.Create(&cfile, filepath.Dir(cname)); err != nil { _, err := chart.Create(&cfile, filepath.Dir(cname))
return err return err
}
return nil
} }

@ -89,10 +89,7 @@ func runRepoRemove(cmd *cobra.Command, args []string) error {
if err := checkArgsLength(1, len(args), "name of chart repository"); err != nil { if err := checkArgsLength(1, len(args), "name of chart repository"); err != nil {
return err return err
} }
if err := removeRepoLine(args[0]); err != nil { return removeRepoLine(args[0])
return err
}
return nil
} }
func runRepoIndex(cmd *cobra.Command, args []string) error { func runRepoIndex(cmd *cobra.Command, args []string) error {
@ -105,11 +102,7 @@ func runRepoIndex(cmd *cobra.Command, args []string) error {
return err return err
} }
if err := index(path, args[1]); err != nil { return index(path, args[1])
return err
}
return nil
} }
func index(dir, url string) error { func index(dir, url string) error {
@ -118,10 +111,7 @@ func index(dir, url string) error {
return err return err
} }
if err := chartRepo.Index(); err != nil { return chartRepo.Index()
return err
}
return nil
} }
func removeRepoLine(name string) error { func removeRepoLine(name string) error {
@ -165,9 +155,5 @@ func insertRepoLine(name, url string) error {
f.Repositories[name] = url f.Repositories[name] = url
b, _ := yaml.Marshal(&f.Repositories) b, _ := yaml.Marshal(&f.Repositories)
if err := ioutil.WriteFile(repositoriesFile(), b, 0666); err != nil { return ioutil.WriteFile(repositoriesFile(), b, 0666)
return err
}
return nil
} }

@ -17,7 +17,7 @@ func newTillerPortForwarder() (*kube.Tunnel, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
// FIXME use a constain that is accessable on init // FIXME use a constain that is accessible on init
const tillerPort = 44134 const tillerPort = 44134
return kube.New(nil).ForwardPort("helm", podName, tillerPort) return kube.New(nil).ForwardPort("helm", podName, tillerPort)
} }

@ -191,11 +191,7 @@ func findMember(root, path string, members []*Member) error {
for _, member := range members { for _, member := range members {
if member.Path == path { if member.Path == path {
filename := filepath.Join(root, path) filename := filepath.Join(root, path)
if err := compareContent(filename, member.Content); err != nil { return compareContent(filename, member.Content)
return err
}
return nil
} }
} }

@ -103,11 +103,7 @@ func Save(c *Chart, outDir string) (string, error) {
} }
_, err = io.Copy(twriter, in) _, err = io.Copy(twriter, in)
in.Close() in.Close()
if err != nil { return err
return err
}
return nil
}) })
if err != nil { if err != nil {
rollback = true rollback = true

@ -46,11 +46,7 @@ func AddChartToLocalRepo(ch *chart.Chart, path string) error {
if err != nil { if err != nil {
return err return err
} }
err = Reindex(ch, path+"/index.yaml") return Reindex(ch, path+"/index.yaml")
if err != nil {
return err
}
return nil
} }
// Reindex adds an entry to the index file at the given path // Reindex adds an entry to the index file at the given path

@ -98,11 +98,7 @@ func (r *ChartRepository) saveIndexFile() error {
return err return err
} }
if err = ioutil.WriteFile(filepath.Join(r.RootPath, indexPath), index, 0644); err != nil { return ioutil.WriteFile(filepath.Join(r.RootPath, indexPath), index, 0644)
return err
}
return nil
} }
func (r *ChartRepository) Index() error { func (r *ChartRepository) Index() error {
@ -143,11 +139,7 @@ func (r *ChartRepository) Index() error {
} }
if err := r.saveIndexFile(); err != nil { return r.saveIndexFile()
return err
}
return nil
} }
func generateChecksum(path string) (string, error) { func generateChecksum(path string) (string, error) {

Loading…
Cancel
Save