Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

group all stdlib imports together #3

Closed
ewgRa opened this issue Mar 26, 2018 · 7 comments
Closed

group all stdlib imports together #3

ewgRa opened this issue Mar 26, 2018 · 7 comments

Comments

@ewgRa
Copy link
Owner

ewgRa commented Mar 26, 2018

import (
	"os"
	"strconv"

	"path"

must be

import (
	"os"
	"strconv"
	"path"

Inpired by elastic/beats#6641 (comment)

ewgRa added a commit that referenced this issue Jul 24, 2018
@ewgRa
Copy link
Owner Author

ewgRa commented Jul 24, 2018

closed by #8

@ewgRa ewgRa closed this as completed Jul 24, 2018
@quasilyte
Copy link

Doesn't goimports already do that?

@ewgRa
Copy link
Owner Author

ewgRa commented Aug 3, 2018

@quasilyte and yes and no

package main

import (
    "os"
)

import (
    "fmt"
)

import "strings"

func main() {
	fmt.Println(strings.Split("a", "aa"), os.Readlink("b"))
}

Will be not changed by goimports. Idea is that such code must looks like:

package main

import (
    "fmt"
    "os"
    "strings"
)

func main() {
	fmt.Println(strings.Split("a", "aa"), os.Readlink("b"))
}

@quasilyte
Copy link

Interesting, thanks. Maybe there is an open issue on goimports already or we can make one.

@ewgRa
Copy link
Owner Author

ewgRa commented Aug 3, 2018

@quasilyte I will later check goimports issues, I think it is kind of expected behavior

@ewgRa
Copy link
Owner Author

ewgRa commented Aug 3, 2018

@quasilyte can't find any already created similar issue, create one golang/go#26795, will see is it a feature or a bug

@quasilyte
Copy link

@ewgRa, nice! Thanks for doing it!

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

No branches or pull requests

2 participants