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

x/tools/cmd/goimports: external package is preferred over package level variable #12180

Closed
mgenov opened this issue Aug 18, 2015 · 1 comment
Closed

Comments

@mgenov
Copy link

mgenov commented Aug 18, 2015

In db.go

package api

type Stat struct {
}

type DB struct {
    Stats *Stat
}

var (
    store = &DB{&Stat{}}
)

In stats.go

package api

// this line is imported by goimports automatically, where it shouldn't 
import "github.com/coreos/etcd/store" 

func takeStats() {
    s := store.Stats

    s = nil
}

go version go1.5rc1 darwin/amd64
Tools revision: 9f2124f (HEAD)

@bradfitz
Copy link
Contributor

Dup of #7463

@golang golang locked and limited conversation to collaborators Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants