Skip to content

Handle newlines in blocks caused by conflict with goimports #76

Closed
@avorima

Description

Multi-line comments separated with newlines cause conflicts with goimports.

Given:

package proc

import (
	"github.com/a/b"
	"github.com/local/foo"

	// A multi-line comment explaining what this dependency
	// is used for or what it initializes.
	_ "github.com/client/auth"
)
sections:
  - Standard
  - Default
  - Prefix(github.com/local)

The result is:

package proc

import (
	"github.com/a/b"
	// A multi-line comment explaining what this dependency
	// is used for or what it initializes.
	_ "github.com/client/auth"

	"github.com/local/foo"
)

But goimports will format it as:

package proc

import (
	"github.com/a/b"

	// A multi-line comment explaining what this dependency
	// is used for or what it initializes.
	_ "github.com/client/auth"

	"github.com/local/foo"
)

This means that the two cannot be used together, e.g. with golangci-lint.

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions