1
0
mirror of https://github.com/golang/go synced 2024-10-01 11:28:34 -06:00
Commit Graph

6 Commits

Author SHA1 Message Date
Brad Fitzpatrick
a2dc47679d Revert "imports: support repairing import grouping/ordering"
This reverts commit CL 116795 12a7c317e8.

Reason for revert: mangles comments in imports. See comments
on issue golang/go#20818.

Updates golang/go#20818

Change-Id: Iff82f8dc310dceb982b48d82b26176ea279fef10
Reviewed-on: https://go-review.googlesource.com/c/144339
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2018-10-24 17:12:08 +00:00
Serhii Aheienko
12a7c317e8 imports: support repairing import grouping/ordering
The existing implementation detects import groups and tryies to
sort/regroup only the last one. Ignore existing grouping and
applying the sort function to all imports fix this.

Fixes golang/go#20818

Change-Id: I5db46c6dc8fabd9299b79349880994be5c1b8195
Reviewed-on: https://go-review.googlesource.com/c/116795
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-12 15:41:53 +00:00
LE Manh Cuong
d600f31f81 imports: fix unexpected blank line after package comment
The fix in golang/go#23709 introduced a separate bug where extra blank
lines were sometimes inserted. This fixes that newly introduced bug.

Fixes golang/go#26246

Change-Id: I78131cc1d01ae246922ed9e4336ebb31d1c6cfa1
Reviewed-on: https://go-review.googlesource.com/122538
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 17:31:08 +00:00
LE Manh Cuong
b23eb6252f imports: fixup comments on import lines correctly
The current implementation uses the added import specs EndPos to fixup
the comments position after import specs is sorted. If two or more
import specs have the same EndPos, a comment associated with one of them
is always added to the last import spec.

This commit uses the current import spec position to compute new
position for next import spec. So there is never two or more specs have
the same EndPos.

Fixes golang/go#23709

Change-Id: I60ace9431d871e94a2b3d90892aa80d0671aeea0
Reviewed-on: https://go-review.googlesource.com/121878
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-02 20:27:37 +00:00
David Symonds
8297301f3a imports: Remove ancient Go 1.1 compatibility indirections.
Change-Id: Id389cba2d3696c3bd2c2987ddc1768059747e8ac
Reviewed-on: https://go-review.googlesource.com/17793
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-14 00:47:31 +00:00
David Crawshaw
c87866116c go.tools/imports: move goimports from github to go.tools.
From revision d0880223588919729793727c9d65f202a73cda77.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/35850048
2013-12-17 21:21:03 -05:00