grim/convey

Linting

2018-02-18, Gary Kramlich
cab4e3de10a6
Parents ad96c0ecad0e
Children f3a61cc7b59d
Linting
--- a/aws/aws.go Sun Feb 18 22:30:30 2018 -0600
+++ b/aws/aws.go Sun Feb 18 23:52:02 2018 -0600
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-// Package intrinsic contains the intrinsic commands
+// Package aws contains the tasks for interacting with AWS.
package aws
import (
--- a/aws/ecr-get-login.go Sun Feb 18 22:30:30 2018 -0600
+++ b/aws/ecr-get-login.go Sun Feb 18 23:52:02 2018 -0600
@@ -17,6 +17,8 @@
package aws
import (
+ "fmt"
+
"github.com/aphistic/gomol"
"github.com/kballard/go-shellquote"
@@ -27,12 +29,13 @@
"bitbucket.org/rw_grim/convey/tasks"
)
+// ECRGetLogin represents an `aws ecr get-login` command.
type ECRGetLogin struct {
Region string `yaml:"region"`
}
-// Executes the `aws ecr get-login` command and calls docker login with the
-// results
+// Execute runs the `aws ecr get-login` command and calls docker login with the
+// results.
func (ecr *ECRGetLogin) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -48,7 +51,11 @@
stdout, stderr, err := command.RunOutput(name, cmd.Command(), st.PlanTimeout)
if err != nil {
- logger.Warnf("error: %s", stderr)
+ nErr := logger.Warnf("error: %s", stderr)
+ if nErr != nil {
+ fmt.Printf("error writing warning: %s\n", nErr)
+ err = nErr
+ }
return err
}
--- a/aws/errors.go Sun Feb 18 22:30:30 2018 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-// Convey
-// Copyright 2016-2018 Gary Kramlich <grim@reaperworld.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-package aws
-
-import (
- "errors"
-)
-
-var (
- errNoRegion = errors.New("no region specified")
-)
--- a/main.go Sun Feb 18 22:30:30 2018 -0600
+++ b/main.go Sun Feb 18 23:52:02 2018 -0600
@@ -178,7 +178,7 @@
// now make sure we found a config file
if *configFile == "" {
- err := fmt.Errorf("config file not found, looking for %s\n", strings.Join(loader.Filenames(), ","))
+ err := fmt.Errorf("config file not found, looking for %s", strings.Join(loader.Filenames(), ","))
return nil, "", err
}
@@ -209,11 +209,16 @@
st := state.New()
// setup logging
- if err := logging.Setup(*color, *verbose); err != nil {
+ if err = logging.Setup(*color, *verbose); err != nil {
fmt.Printf("failed to setup logging: %s\n", err)
return 1
}
- defer gomol.ShutdownLoggers()
+ defer func() {
+ e := gomol.ShutdownLoggers()
+ if e != nil {
+ fmt.Printf("error: %s\n", err)
+ }
+ }()
// now defer the state shutdown so we can still log
defer st.Destroy()