Skip to content

Commit

Permalink
chore: remove unused lint directives (#2864)
Browse files Browse the repository at this point in the history
Remove unused nonamedreturns directives as this linter was replaced by
nakedret.
  • Loading branch information
stevenh authored Oct 30, 2024
1 parent a489482 commit 606369d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ func (p *DockerProvider) BuildImage(ctx context.Context, img ImageBuildInfo) (st
}

// CreateContainer fulfils a request for a container without starting it
func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerRequest) (con Container, err error) { //nolint:nonamedreturns // Needed for error checking.
func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerRequest) (con Container, err error) {
// defer the close of the Docker client connection the soonest
defer p.Close()

Expand Down Expand Up @@ -1277,7 +1277,7 @@ func (p *DockerProvider) waitContainerCreation(ctx context.Context, name string)
)
}

func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req ContainerRequest) (con Container, err error) { //nolint:nonamedreturns // Needed for error check.
func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req ContainerRequest) (con Container, err error) {
c, err := p.findContainerByName(ctx, req.Name)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1486,7 +1486,7 @@ func (p *DockerProvider) daemonHostLocked(ctx context.Context) (string, error) {

// Deprecated: use network.New instead
// CreateNetwork returns the object representing a new network identified by its name
func (p *DockerProvider) CreateNetwork(ctx context.Context, req NetworkRequest) (net Network, err error) { //nolint:nonamedreturns // Needed for error check.
func (p *DockerProvider) CreateNetwork(ctx context.Context, req NetworkRequest) (net Network, err error) {
// defer the close of the Docker client connection the soonest
defer p.Close()

Expand Down
2 changes: 1 addition & 1 deletion modules/grafana-lgtm/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func ExampleRun_otelCollector() {

// setupOTelSDK bootstraps the OpenTelemetry pipeline.
// If it does not return an error, make sure to call shutdown for proper cleanup.
func setupOTelSDK(ctx context.Context, ctr *grafanalgtm.GrafanaLGTMContainer) (shutdown func(context.Context) error, err error) { //nolint:nonamedreturns // this is a pattern in the OpenTelemetry Go SDK
func setupOTelSDK(ctx context.Context, ctr *grafanalgtm.GrafanaLGTMContainer) (shutdown func(context.Context) error, err error) {
var shutdownFuncs []func(context.Context) error

// shutdown calls cleanup functions registered via shutdownFuncs.
Expand Down
2 changes: 1 addition & 1 deletion port_forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var sshPassword = uuid.NewString()
// 1. Create a new SSHD container.
// 2. Expose the host ports to the container after the container is ready.
// 3. Close the SSH sessions before killing the container.
func exposeHostPorts(ctx context.Context, req *ContainerRequest, ports ...int) (sshdConnectHook ContainerLifecycleHooks, err error) { //nolint:nonamedreturns // Required for error check.
func exposeHostPorts(ctx context.Context, req *ContainerRequest, ports ...int) (sshdConnectHook ContainerLifecycleHooks, err error) {
if len(ports) == 0 {
return sshdConnectHook, fmt.Errorf("no ports to expose")
}
Expand Down
4 changes: 2 additions & 2 deletions reaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (r *reaperSpawner) reaper(ctx context.Context, sessionID string, provider R
// If connect is true, the reaper will be connected to the reaper container.
// It must be called with the lock held.
func (r *reaperSpawner) retryLocked(ctx context.Context, sessionID string, provider ReaperProvider) func() (*Reaper, error) {
return func() (reaper *Reaper, err error) { //nolint:nonamedreturns // Needed for deferred error check.
return func() (reaper *Reaper, err error) {
reaper, err = r.reuseOrCreate(ctx, sessionID, provider)
// Ensure that the reaper is terminated if an error occurred.
defer func() {
Expand Down Expand Up @@ -372,7 +372,7 @@ func (r *reaperSpawner) fromContainer(ctx context.Context, sessionID string, pro

// newReaper creates a connected Reaper with a sessionID to identify containers
// and a provider to use.
func (r *reaperSpawner) newReaper(ctx context.Context, sessionID string, provider ReaperProvider) (reaper *Reaper, err error) { //nolint:nonamedreturns // Needed for deferred error check.
func (r *reaperSpawner) newReaper(ctx context.Context, sessionID string, provider ReaperProvider) (reaper *Reaper, err error) {
dockerHostMount := core.MustExtractDockerSocket(ctx)

port := r.port()
Expand Down

0 comments on commit 606369d

Please sign in to comment.