Skip to content

[Go] [Bug] Unused "errors" import #3469

@neilotoole

Description

@neilotoole
Description

My own recent PR #3460 removed invalid error checking code (which used the errors package), but it did not remove the errors import.

 import (
    "strings"
    "fmt"
    "errors"
    "net/url"
Post-mortem

The Go CI mechanism was bust at the time, so it wasn't caught there.

How this bug escaped me in local testing is mildly interesting. I was generating Go files into a particular directory as part of a project. However, I had the goimports tools set up (via a file watcher) to automatically run on modified Go files. Therefore goimports cleaned up the error before I ever saw it. This is a good argument for always testing in a clean Docker container before submitting a PR (this is required practice on my own corporate team).

Swagger-codegen version

master

Suggest a Fix

Remove the offending import.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions