diff --git a/gw/run.go b/gw/run.go index 6a742be..ea204a6 100644 --- a/gw/run.go +++ b/gw/run.go @@ -50,7 +50,7 @@ func Run(fn func(ts *Task) error) error { if err != nil { return fmt.Errorf("fail to configure TLS: %w", err) } - c, err := NewTask(addr, Runtime{ + c, err := newTask(addr, runtime{ OrgName: orgName, WorkingDir: os.Getenv(EnvWorkingDir), ProcessID: os.Getenv(EnvProcessID), diff --git a/gw/task.go b/gw/task.go index 1e9f281..ffe7aa4 100644 --- a/gw/task.go +++ b/gw/task.go @@ -18,28 +18,32 @@ import ( "google.golang.org/grpc" ) -// NewTask creates a new Task connection between the client and the GRPC service on the agent -func NewTask(addr string, rt Runtime, opts ...grpc.DialOption) (*Task, error) { +// newTask creates a new Task connection between the client and the GRPC service on the agent +func newTask(addr string, rt runtime, opts ...grpc.DialOption) (*Task, error) { conn, err := grpc.Dial(addr, opts...) if err != nil { return nil, fmt.Errorf("unable to connect to grpc server %q: %w", addr, err) } return &Task{ - Runtime: rt, - conn: conn, + OrgName: rt.OrgName, + WorkingDir: rt.WorkingDir, + ProcessID: rt.ProcessID, + conn: conn, }, nil } -// Runtime contains the process runtime information given by the goodwill plugin -type Runtime struct { +// runtime contains the process runtime information +type runtime struct { OrgName string WorkingDir string ProcessID string } type Task struct { - Runtime - conn *grpc.ClientConn + OrgName string + WorkingDir string + ProcessID string + conn *grpc.ClientConn } const (