Skip to content

Commit

Permalink
agent: rename BuildAndStart to Start
Browse files Browse the repository at this point in the history
  • Loading branch information
nadiamoe committed Sep 13, 2023
1 parent 87377ca commit 6d8372e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/agent/commands/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/commands/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 6d8372e

Please sign in to comment.