diff --git a/cmd/agent/commands/grpc.go b/cmd/agent/commands/grpc.go index 2dfc6f97..08d6afaa 100644 --- a/cmd/agent/commands/grpc.go +++ b/cmd/agent/commands/grpc.go @@ -42,7 +42,7 @@ func BuildGrpcCmd(env runtime.Environment, config *agent.Config) *cobra.Command return fmt.Errorf("upstream host cannot be localhost when running in transparent mode") } - agent, err := agent.BuildAndStart(env, config) + agent, err := agent.Start(env, config) if err != nil { return fmt.Errorf("initializing agent: %w", err) } diff --git a/cmd/agent/commands/http.go b/cmd/agent/commands/http.go index a65f4b1c..bd054e37 100644 --- a/cmd/agent/commands/http.go +++ b/cmd/agent/commands/http.go @@ -41,7 +41,7 @@ func BuildHTTPCmd(env runtime.Environment, config *agent.Config) *cobra.Command return fmt.Errorf("upstream host cannot be localhost when running in transparent mode") } - agent, err := agent.BuildAndStart(env, config) + agent, err := agent.Start(env, config) if err != nil { return fmt.Errorf("initializing agent: %w", err) } diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index d0b5560d..a2af9c39 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -26,11 +26,11 @@ type Agent struct { profileCloser io.Closer } -// BuildAndStart creates and starts a new instance of an agent. +// Start creates and starts a new instance of an agent. // Returned agent is guaranteed to be unique in the environment it is running, and will handle signals sent to the // process. // Callers must Stop the returned agent at the end of its lifecycle. -func BuildAndStart(env runtime.Environment, config *Config) (*Agent, error) { +func Start(env runtime.Environment, config *Config) (*Agent, error) { a := &Agent{ env: env, } diff --git a/pkg/agent/agent_test.go b/pkg/agent/agent_test.go index baa1ff53..ba76e41d 100644 --- a/pkg/agent/agent_test.go +++ b/pkg/agent/agent_test.go @@ -63,7 +63,7 @@ func Test_CancelContext(t *testing.T) { t.Parallel() env := runtime.NewFakeRuntime(tc.args, tc.vars) - agent, err := BuildAndStart(env, tc.config) + agent, err := Start(env, tc.config) if err != nil { t.Fatalf("starting agent: %v", err) } @@ -131,7 +131,7 @@ func Test_Signals(t *testing.T) { t.Parallel() env := runtime.NewFakeRuntime(tc.args, tc.vars) - agent, err := BuildAndStart(env, tc.config) + agent, err := Start(env, tc.config) if err != nil { t.Fatalf("starting agent: %v", err) }