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/compile: non-deterministic output order for unused import errors #20298

Closed
josharian opened this issue May 9, 2017 · 1 comment
Closed
Milestone

Comments

@josharian
Copy link
Contributor

Compile this file multiple times:

package p

import (
        "bufio"
        "bytes"
        "crypto/x509"
        "flag"
        "fmt"
        "io"
        "io/ioutil"
        "log"
        "math"
        "math/big"
        "math/bits"
        "net"
        "net/http"
        "os"
        "path"
        "path/filepath"
        "regexp"
        "strings"
)

The output varies. Two sample runs:

$ go tool compile x.go 
x.go:6:2: imported and not used: "crypto/x509"
x.go:9:2: imported and not used: "io"
x.go:10:2: imported and not used: "io/ioutil"
x.go:11:2: imported and not used: "log"
x.go:12:2: imported and not used: "math"
x.go:13:2: imported and not used: "math/big"
x.go:16:2: imported and not used: "net/http"
x.go:18:2: imported and not used: "path"
x.go:19:2: imported and not used: "path/filepath"
x.go:21:2: imported and not used: "strings"
x.go:10:2: too many errors
$ go tool compile x.go 
x.go:4:2: imported and not used: "bufio"
x.go:5:2: imported and not used: "bytes"
x.go:11:2: imported and not used: "log"
x.go:12:2: imported and not used: "math"
x.go:13:2: imported and not used: "math/big"
x.go:14:2: imported and not used: "math/bits"
x.go:15:2: imported and not used: "net"
x.go:17:2: imported and not used: "os"
x.go:20:2: imported and not used: "regexp"
x.go:21:2: imported and not used: "strings"
x.go:14:2: too many errors

It'd be preferable for the output to be deterministic.

Fix is easy and safe; CL soon.

@josharian josharian added this to the Go1.9 milestone May 9, 2017
@gopherbot
Copy link

CL https://golang.org/cl/42954 mentions this issue.

@golang golang locked and limited conversation to collaborators May 9, 2018
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

2 participants