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: reads build tags lines even in the middle of source files #3914
Labels
Comments
$ cat p_test.go // Comment. package modsql import "testing" func TestBlob(t *testing.T) { println("hello") } // +build sqlite $ go test -v can't load package: package testa: no Go source files in /home/remy/travail/go/src/testa $ go test -v -tags sqlite === RUN TestBlob hello --- PASS: TestBlob (0.00 seconds) PASS ok testa 0.006s |
Comment 3 by raul.san@sent.com: Note that I use a build constraint in the middle of my code because I'm testing the output of a function which generates files with that header. $ cat p_test.go // Comment. package foo import ("fmt"; "testing") func TestBlob(t *testing.T) { println("hello") } func ExampleSQL() { fmt.Println("// +build sqlite") // Output: /* // +build sqlite */ } $ go test -v can't load package: package .: no Go source files in /home/neo/go/foo $ go test -v -tags sqlite === RUN TestBlob hello --- PASS: TestBlob (0.00 seconds) === RUN: ExampleSQL --- PASS: ExampleSQL (0.00 seconds) PASS ok _/home/neo/go/foo 0.006s |
Labels changed: added priority-soon, removed priority-triage. Owner changed to @robpike. Status changed to Started. |
This issue was closed by revision f087764. Status changed to Fixed. |
Issue #3992 has been merged into this issue. |
gopherbot
pushed a commit
that referenced
this issue
May 11, 2015
…contents of file. ««« backport 307fafbc2d6f go/build: correct shouldBuild bug reading whole contents of file. It was caused by bytes.TrimSpace being able to return a nil slice. Fixes #3914. R=golang-dev, r CC=golang-dev, remy https://golang.org/cl/6458091 »»»
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by raul.san@sent.com:
The text was updated successfully, but these errors were encountered: