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

go/build: deps_test.go complaining about "+build ignore" sources #12349

Closed
mdempsky opened this issue Aug 26, 2015 · 2 comments
Closed

go/build: deps_test.go complaining about "+build ignore" sources #12349

mdempsky opened this issue Aug 26, 2015 · 2 comments

Comments

@mdempsky
Copy link
Member

I have src/encoding/gob/blorp.go (dated from Apr 17) in my source tree with the following contents for some reason (probably just an artifact related to investigating a bug a while back):

// +build ignore

package main

import (
    "bytes"
    "encoding/gob"
    "encoding/hex"
    "fmt"
    "log"
)

func main() {
    x := make([]int, 1000)
    fmt.Println(len(x))

    var b bytes.Buffer
    if err := gob.NewEncoder(&b).Encode(x); err != nil {
        log.Fatal(err)
    }
    fmt.Println(hex.EncodeToString(b.Bytes())[:52] + "...")
}

However, updating to a34b8cb, deps_test.go is now failing for me unless I remove it:

$ go test go/build
--- FAIL: TestDependencies (0.07s)
    deps_test.go:472: unexpected dependency: encoding/gob imports [encoding/gob encoding/hex]
FAIL
FAIL    go/build    0.088s

If this is working as intended, then I'm happy to just remove the culprit file. Just reporting in case the change in test behavior was not intentional.

@mdempsky
Copy link
Member Author

FWIW, git bisect identified 54a966e as the CL where this behavior change happened.

@mdempsky
Copy link
Member Author

Looks like deps_test.go expects a newline character before the "// +build ignore" command, presumably because proper source files in the tree should all start with license headers: 54a966e#diff-46b0925ee213530c712e3199549cae21R479

If I had a blank line to the top of blorp.go, then deps_test.go passes again. I can live with that.

@golang golang locked and limited conversation to collaborators Sep 4, 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

2 participants