Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conventional import ordering in generated code #396

Closed
martinxsliu opened this issue Dec 5, 2017 · 2 comments
Closed

Conventional import ordering in generated code #396

martinxsliu opened this issue Dec 5, 2017 · 2 comments

Comments

@martinxsliu
Copy link
Contributor

Currently, in the code generated by the ginkgo bootstrap and ginkgo generate commands, the imports are ordered like:

// ginkgo bootstrap
import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

// ginkgo generate
import (
	. "github.com/martinxsl/foo/bar"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

This goes against conventional rules which suggests that standard library imports should come first (e.g. see: https://github.com/golang/go/wiki/CodeReviewComments#imports) followed by third party imports and then followed up by local imports (which is encouraged by goimports).

I propose that we reverse the grouping of imports so that it does follow conventions like so:

// ginkgo bootstrap
import (
	"testing"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

// ginkgo generate
import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "github.com/martinxsl/foo/bar"
)

I'm happy to open a PR for this.

@williammartin
Copy link
Collaborator

Hey @martinxsliu cool catch. Happy to review a PR for this.

@williammartin
Copy link
Collaborator

Merged the PR so I'm gonna close this, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants