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

Try to simplify goimports #308

Closed
wants to merge 1 commit into from
Closed

Conversation

kamilsk
Copy link

@kamilsk kamilsk commented Apr 24, 2021

Related to:

It tries to fix:

Appears in:

Example

the input

package testdata

import (
	_ "net"
	_ "encoding"

	_ "golang.org/x/mod/semver"

	_ "golang.org/x/sync/errgroup"

	_ "golang.org/x/tools/internal/imports"
)

Current behaviour

$ goimports testdata/example.go
package testdata

import (
        _ "encoding"
        _ "net"

        _ "golang.org/x/mod/semver"

        _ "golang.org/x/sync/errgroup"

        _ "golang.org/x/tools/internal/imports"
)

$ goimports -local golang.org/x/tools testdata/example.go
package testdata

import (
        _ "encoding"
        _ "net"

        _ "golang.org/x/mod/semver"

        _ "golang.org/x/sync/errgroup"

        _ "golang.org/x/tools/internal/imports"
)

$ goimports -local golang.org/x/tools,golang.org/x/mod testdata/example.go
package testdata

import (
        _ "encoding"
        _ "net"

        _ "golang.org/x/mod/semver"

        _ "golang.org/x/sync/errgroup"

        _ "golang.org/x/tools/internal/imports"
)

Patched behavior

$ ./patched testdata/example.go
package testdata

import (
        _ "encoding"
        _ "net"

        _ "golang.org/x/mod/semver"
        _ "golang.org/x/sync/errgroup"
        _ "golang.org/x/tools/internal/imports"
)

$ ./patched -local golang.org/x/tools testdata/example.go
package testdata

import (
        _ "encoding"
        _ "net"

        _ "golang.org/x/mod/semver"
        _ "golang.org/x/sync/errgroup"

        _ "golang.org/x/tools/internal/imports"
)

$ ./patched -local golang.org/x/tools,golang.org/x/mod testdata/example.go
package testdata

import (
	_ "encoding"
	_ "net"

	_ "golang.org/x/sync/errgroup"

	_ "golang.org/x/mod/semver"
	_ "golang.org/x/tools/internal/imports"
)

@google-cla google-cla bot added the cla: yes label Apr 24, 2021
@kamilsk kamilsk changed the title simplify goimports Try to simplify goimports Apr 24, 2021
@gopherbot
Copy link
Contributor

This PR (HEAD: f8c79ef) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/tools/+/313090 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@kamilsk kamilsk force-pushed the simplify-goimports branch from f8c79ef to 1666f5c Compare April 26, 2021 17:47
@gopherbot
Copy link
Contributor

This PR (HEAD: 1666f5c) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/tools/+/313090 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Heschi Kreinick:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/313090.
After addressing review feedback, remember to publish your drafts!

@kamilsk kamilsk closed this Apr 26, 2021
@kamilsk kamilsk deleted the simplify-goimports branch April 26, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants