From #1078. There are a few different ideas of how to order imports and where the line breaks should be. Let's decide which style makes sense to the most people, then implement a formatter in sockpuppet that can reformat imports automatically.
Examples of conventions that have been proposed:
import (
// standard lib, enforced by gofmt
"log"
// vendored code. These packages cannot be changed by the developer.
corev1 "k8s.io/api/core/v1"
// in-repo code. These packages can be changed by the developer.
"github.com/knative/eventing/pkg/broker"
// dot imports. These are separate because the developer must recognize them in advance
// to understand the code.
. "github.com/knative/pkg/controller/testing"
)
import (
// standard lib, enforced by gofmt
"log"
// vendored code. These packages cannot be changed by the developer.
corev1 "k8s.io/api/core/v1"
// vendored code. These packages cannot be changed by the developer.
cloudevents "github.com/cloudevents/sdk-go"
// in-repo code. These packages can be changed by the developer.
"github.com/knative/eventing/pkg/broker"
// dot imports. These are separate because the developer must recognize them in advance
// to understand the code.
. "github.com/knative/pkg/controller/testing"
)
import (
// standard lib, enforced by gofmt
"log"
// dot imports. These are separate because the developer must recognize them in advance
// to understand the code. These are also quite rare.
. "github.com/knative/pkg/controller/testing"
// All 'normal' imports that aren't part of the standard lib, regardless of whether they are in repo or vendored.
corev1 "k8s.io/api/core/v1"
"github.com/knative/eventing/pkg/broker"
)
/good-first-issue
From #1078. There are a few different ideas of how to order imports and where the line breaks should be. Let's decide which style makes sense to the most people, then implement a formatter in sockpuppet that can reformat imports automatically.
Examples of conventions that have been proposed:
/good-first-issue