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

Standardize grouping of package imports #270

Closed
laser opened this issue Apr 6, 2018 · 2 comments
Closed

Standardize grouping of package imports #270

laser opened this issue Apr 6, 2018 · 2 comments

Comments

@laser
Copy link
Contributor

laser commented Apr 6, 2018

Description

There exist a few different styles in the codebase today (see here and here). We should come up with a set of rules for how imported packages grouped together and enshrine those rules into our contribution doc.

I propose:

import (
        [stdlib packages, alpha-sorted]
        <single, empty line>
        [gx-installed packages]
        <single, empty line>
        [go get-installed packages (not part of go-filecoin)]
        <single, empty line>
        [go-filecoin packages]
)

Example:

import (
	"context"
	"testing"

	cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds"
	"gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
	ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"

	"github.com/stretchr/testify/assert"

	"github.com/filecoin-project/go-filecoin/testhelpers"
	"github.com/filecoin-project/go-filecoin/types"
)
@dignifiedquire
Copy link
Contributor

I think we already agree on this, so 👍 from me for making it explicit

@phritz
Copy link
Contributor

phritz commented Apr 25, 2018

can i make my editor do this automatically? i use goimports on save which fixes things up but would love an additional hook. seems low pri but thought i'd ask.

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

No branches or pull requests

3 participants