Skip to content

Add import grouping to the styleguide #17

@ekcasey

Description

@ekcasey

We should describe how import statements should be grouped in the styleguide. This seems like a great example of the kind of detail that can cause unnecessary back-and-forth on a PR. I would suggest we organize imports in one delaration with three groups:

  1. stdlib
  2. external (imported from another repo or module)
  3. internal (same module)

This can be configured in Goland with the following settings:
Screen Shot 2021-02-26 at 4 43 38 PM

Or automated with the following command:

goimports -l -w -local <module> .

e.g

goimports -l -w -local github.com/paketo-buildpacks/environment-variables .

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions