@@ -10,7 +10,7 @@ import (
10
10
// An Operator implements a Run() method. When a job executes a task that
11
11
// uses the operator, the Run() method is called.
12
12
type Operator interface {
13
- Run (* Execution ) (any , error )
13
+ Run (* Execution ) (string , error )
14
14
}
15
15
16
16
// Command executes a shell command.
@@ -21,7 +21,7 @@ type Command struct {
21
21
22
22
// Run passes the command and arguments to exec.Command and captures the
23
23
// output.
24
- func (o Command ) Run (e * Execution ) (any , error ) {
24
+ func (o Command ) Run (e * Execution ) (string , error ) {
25
25
out , err := exec .Command (o .Cmd , o .Args ... ).Output ()
26
26
return string (out ), err
27
27
}
@@ -34,15 +34,15 @@ type Get struct {
34
34
35
35
// Run sends the request and returns an error if the status code is
36
36
// outside the 2xx range.
37
- func (o Get ) Run (e * Execution ) (any , error ) {
37
+ func (o Get ) Run (e * Execution ) (string , error ) {
38
38
res , err := o .Client .Get (o .URL )
39
39
if err != nil {
40
- return nil , err
40
+ return "" , err
41
41
}
42
42
defer res .Body .Close ()
43
43
44
44
if res .StatusCode < 200 || res .StatusCode > 299 {
45
- return nil , fmt .Errorf ("Received status code %v" , res .StatusCode )
45
+ return "" , fmt .Errorf ("Received status code %v" , res .StatusCode )
46
46
}
47
47
48
48
content , err := io .ReadAll (res .Body )
@@ -58,15 +58,15 @@ type Post struct {
58
58
59
59
// Run sends the request and returns an error if the status code is
60
60
// outside the 2xx range.
61
- func (o Post ) Run (e * Execution ) (any , error ) {
61
+ func (o Post ) Run (e * Execution ) (string , error ) {
62
62
res , err := o .Client .Post (o .URL , "application/json" , o .Body )
63
63
if err != nil {
64
- return nil , err
64
+ return "" , err
65
65
}
66
66
defer res .Body .Close ()
67
67
68
68
if res .StatusCode < 200 || res .StatusCode > 299 {
69
- return nil , fmt .Errorf ("Received status code %v" , res .StatusCode )
69
+ return "" , fmt .Errorf ("Received status code %v" , res .StatusCode )
70
70
}
71
71
72
72
content , err := io .ReadAll (res .Body )
0 commit comments