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

cmd/gofmt: align renamed imports #32189

Open
dsnet opened this issue May 22, 2019 · 2 comments

Comments

@dsnet
Copy link
Member

commented May 22, 2019

Currently, my import block looks something like:

import (
	"bytes"
	"math"
	"reflect"
	"testing"

	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"
	"google.golang.org/protobuf/internal/encoding/pack"
	pimpl "google.golang.org/protobuf/internal/impl"
	"google.golang.org/protobuf/internal/pragma"
	ptype "google.golang.org/protobuf/internal/prototype"
	"google.golang.org/protobuf/internal/scalar"
	pref "google.golang.org/protobuf/reflect/protoreflect"
	preg "google.golang.org/protobuf/reflect/protoregistry"
	piface "google.golang.org/protobuf/runtime/protoiface"

	proto2_20180125 "google.golang.org/protobuf/internal/testprotos/legacy/proto2.v1.0.0-20180125-92554152"
)

Most of the import paths have a shared prefix, but the lack of aligning makes this hard to see. Preferably, gofmt would align the imports like:

import (
	"bytes"
	"math"
	"reflect"
	"testing"

	       "github.com/google/go-cmp/cmp"
	       "github.com/google/go-cmp/cmp/cmpopts"
	       "google.golang.org/protobuf/internal/encoding/pack"
	pimpl  "google.golang.org/protobuf/internal/impl"
	       "google.golang.org/protobuf/internal/pragma"
	ptype  "google.golang.org/protobuf/internal/prototype"
	       "google.golang.org/protobuf/internal/scalar"
	pref   "google.golang.org/protobuf/reflect/protoreflect"
	preg   "google.golang.org/protobuf/reflect/protoregistry"
	piface "google.golang.org/protobuf/runtime/protoiface"

	proto2_20180125 "google.golang.org/protobuf/internal/testprotos/legacy/proto2.v1.0.0-20180125-92554152"
)
@bcmills

This comment has been minimized.

Copy link
Member

commented May 22, 2019

@bcmills bcmills added this to the Proposal milestone May 22, 2019
@griesemer griesemer self-assigned this May 22, 2019
@griesemer griesemer removed the Proposal label May 22, 2019
@griesemer griesemer modified the milestones: Proposal, Go1.14 May 22, 2019
@griesemer

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

I'm ok with this if we decide to make this change. Marking for Go 1.14, pending decision.

@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.