grim/convey

Fix some minor linting issues

4 months ago, Elliott Sales de Andrade
62cc853bf396
Parents f2b1178f3266
Children adb6eb2a7d21
Fix some minor linting issues

Testing Done:
Ran `golint`, saw fewer lints, and ran `go build .`

Reviewed at https://reviews.imfreedom.org/r/2869/
--- a/docker/environment.go Sat Dec 09 23:44:59 2023 -0600
+++ b/docker/environment.go Sun Dec 10 05:12:31 2023 -0600
@@ -21,7 +21,7 @@
return fmt.Errorf("The docker/environment tasks was removed in version 0.15.0")
}
-// Executes the task
+// Execute runs the task.
func (e *Environment) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
return nil
}
--- a/docker/export.go Sat Dec 09 23:44:59 2023 -0600
+++ b/docker/export.go Sun Dec 10 05:12:31 2023 -0600
@@ -31,7 +31,7 @@
return e.realExport.Valid()
}
-// Executes the task
+// Execute runs the task.
func (e *Export) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
return e.realExport.Execute(name, logger, env, rt)
}
--- a/docker/import.go Sat Dec 09 23:44:59 2023 -0600
+++ b/docker/import.go Sun Dec 10 05:12:31 2023 -0600
@@ -31,7 +31,7 @@
return i.realImport.Valid()
}
-// Executes the task
+// Execute runs the task.
func (i *Import) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
return i.realImport.Execute(name, logger, env, rt)
}
--- a/docker/run.go Sat Dec 09 23:44:59 2023 -0600
+++ b/docker/run.go Sun Dec 10 05:12:31 2023 -0600
@@ -61,7 +61,7 @@
return r.realRun.Valid()
}
-// Executes the task
+// Execute runs the task.
func (r *Run) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
return r.realRun.Execute(name, logger, env, rt)
}
--- a/docker/tag.go Sat Dec 09 23:44:59 2023 -0600
+++ b/docker/tag.go Sun Dec 10 05:12:31 2023 -0600
@@ -38,7 +38,7 @@
return t.realTag.Valid()
}
-// Executes the task
+// Execute runs the task.
func (t *Tag) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
return t.realTag.Execute(name, logger, env, rt)
}
--- a/environment/expand.go Sat Dec 09 23:44:59 2023 -0600
+++ b/environment/expand.go Sun Dec 10 05:12:31 2023 -0600
@@ -30,9 +30,9 @@
// recursing if the value contains another variable.
func (e Environment) Expand(key string) string {
last := os.Expand(key, e.expandMapper)
- n_tries := 10
+ tries := 10
- for i := 0; i < n_tries; i++ {
+ for i := 0; i < tries; i++ {
next := os.Expand(last, e.expandMapper)
if next == last {
return next
@@ -40,7 +40,7 @@
last = next
}
- log.Warnf("failed to fully expand %q after %d recursions", key, n_tries)
+ log.Warnf("failed to fully expand %q after %d recursions", key, tries)
return ""
}
--- a/podman/run.go Sat Dec 09 23:44:59 2023 -0600
+++ b/podman/run.go Sun Dec 10 05:12:31 2023 -0600
@@ -90,8 +90,8 @@
)
// If --cpu-shares was specified on the command line add it now.
- if rt.CpuShares != "" {
- generator.Append("--cpu-shares", rt.CpuShares)
+ if rt.CPUShares != "" {
+ generator.Append("--cpu-shares", rt.CPUShares)
}
// If --memory was specified on the command line add it now.
--- a/runner/cmd.go Sat Dec 09 23:44:59 2023 -0600
+++ b/runner/cmd.go Sun Dec 10 05:12:31 2023 -0600
@@ -35,7 +35,7 @@
type RunnerCmd struct {
ConfigFile string `kong:"flag,help='The config file to load',placeholder='FILE',short='f',default='convey.yml',name='config'"`
- CpuShares string `kong:"flag,help='The amount of cpu shares given to run tasks',placeholder='CPU-SHARES',short='c'"`
+ CPUShares string `kong:"flag,help='The amount of cpu shares given to run tasks',placeholder='CPU-SHARES',short='c'"`
ForceSequential bool `kong:"flag,help='Force concurrent stages to be ran sequentially',short='S',default='false'"`
KeepWorkspace bool `kong:"flag,help='Keep the workspace directory after running',default='false'"`
Memory string `kong:"flag,help='The amount of memory shares given to run tasks',placeholder='MEMORY',short='m'"`
--- a/runner/runtime.go Sat Dec 09 23:44:59 2023 -0600
+++ b/runner/runtime.go Sun Dec 10 05:12:31 2023 -0600
@@ -32,8 +32,8 @@
rt.Plans = cfg.Plans
rt.MetaPlans = cfg.MetaPlans
- if c.CpuShares != "" {
- rt.CpuShares = c.CpuShares
+ if c.CPUShares != "" {
+ rt.CPUShares = c.CPUShares
}
if c.Memory != "" {
--- a/runtime/count_task.go Sat Dec 09 23:44:59 2023 -0600
+++ b/runtime/count_task.go Sun Dec 10 05:12:31 2023 -0600
@@ -29,7 +29,7 @@
// Execute runs the count task.
func (c *Count) Execute(name string, logger *log.Entry, env environment.Environment, rt *Runtime) error {
- c.Count += 1
+ c.Count++
return nil
}
--- a/runtime/fail.go Sat Dec 09 23:44:59 2023 -0600
+++ b/runtime/fail.go Sun Dec 10 05:12:31 2023 -0600
@@ -28,17 +28,17 @@
type Fail struct{}
// Execute runs the fail task.
-func (c *Fail) Execute(name string, logger *log.Entry, env environment.Environment, rt *Runtime) error {
+func (f *Fail) Execute(name string, logger *log.Entry, env environment.Environment, rt *Runtime) error {
return fmt.Errorf("convey/fail task always fails")
}
// New creates a new fail task.
-func (c *Fail) New() Task {
+func (f *Fail) New() Task {
return &Fail{}
}
// Valid validates the fail task.
-func (c *Fail) Valid() error {
+func (f *Fail) Valid() error {
return nil
}
--- a/runtime/runtime.go Sat Dec 09 23:44:59 2023 -0600
+++ b/runtime/runtime.go Sun Dec 10 05:12:31 2023 -0600
@@ -35,7 +35,7 @@
ForceSequential bool
KeepWorkspace bool
- CpuShares string
+ CPUShares string
Memory string
Timeout time.Duration
--- a/tasks/clone.go Sat Dec 09 23:44:59 2023 -0600
+++ b/tasks/clone.go Sun Dec 10 05:12:31 2023 -0600
@@ -22,7 +22,7 @@
"keep.imfreedom.org/grim/convey/runtime"
)
-// CloneTask creates a task of the given type from the given payload. It
+// Clone creates a task of the given type from the given payload. It
// does this by creating a fresh instance of a task of the target type,
// then marshalling/unmarshalling the payload to that type.
func Clone(task interface{}, taskType runtime.Task) (runtime.Task, error) {
--- a/tasks/export.go Sat Dec 09 23:44:59 2023 -0600
+++ b/tasks/export.go Sun Dec 10 05:12:31 2023 -0600
@@ -46,7 +46,7 @@
return nil
}
-// Executes the task
+// Execute runs the task.
func (e *Export) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
fullEnv := env.Copy().Merge(rt.Environment)
--- a/tasks/import.go Sat Dec 09 23:44:59 2023 -0600
+++ b/tasks/import.go Sun Dec 10 05:12:31 2023 -0600
@@ -47,7 +47,7 @@
return nil
}
-// Executes the task
+// Execute runs the task.
func (i *Import) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
fullEnv := env.Copy().Merge(rt.Environment)
--- a/tasks/noop.go Sat Dec 09 23:44:59 2023 -0600
+++ b/tasks/noop.go Sun Dec 10 05:12:31 2023 -0600
@@ -27,17 +27,17 @@
type Noop struct{}
// Execute runs the noop task.
-func (c *Noop) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
+func (n *Noop) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
return nil
}
// New creates a new noop task.
-func (c *Noop) New() runtime.Task {
+func (n *Noop) New() runtime.Task {
return &Noop{}
}
// Valid validates the noop task.
-func (c *Noop) Valid() error {
+func (n *Noop) Valid() error {
return nil
}