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/vet: go vet failing in directory with cgo and no tests #24193

Closed
variadico opened this issue Mar 1, 2018 · 5 comments
Closed

cmd/vet: go vet failing in directory with cgo and no tests #24193

variadico opened this issue Mar 1, 2018 · 5 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@variadico
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10 darwin/amd64 on macOS 10.13.3.

Does this issue reproduce with the latest release?

This issue does not happen with 1.9.4, only 1.10.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jaime/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jaime/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/x8/d_hkkg0977n90n6ml16tnqlr0000gn/T/go-build981458154=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I created a package that uses cgo. In that package, I call a function defined in a .h file. Then, I ran go vet on that package.

// bar.go
package bar

/*
#import "bar.h"
*/
import "C"

func Bar() {
	C.bar()
}
// bar.h
int bar() {
	return 42;
}

I've created an isolated example at this repo: https://github.com/variadico/vetbug

What did you expect to see?

go vet should have analyzed the Go source files and reported no errors.

What did you see instead?

go vet failed to run, saying there are no Go source files.

@ysmolski
Copy link
Member

ysmolski commented Mar 1, 2018

This was introduced in CL cebc706, https://go-review.googlesource.com/87636
/cc @ianlancetaylor

@andybons andybons added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 7, 2018
@andybons andybons added this to the Go1.11 milestone Mar 7, 2018
@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.10.1 Mar 7, 2018
@gopherbot
Copy link

Change https://golang.org/cl/99175 mentions this issue: cmd/go: run vet on packages with only cgo files

@ianlancetaylor
Copy link
Contributor

Reopening for 1.10.1.

@andybons
Copy link
Member

CL 99175 OK for Go 1.10.1

@andybons andybons added CherryPickApproved Used during the release process for point releases and removed NeedsFix The path to resolution is known, but the work has not been done. labels Mar 27, 2018
@gopherbot
Copy link

Change https://golang.org/cl/102785 mentions this issue: [release-branch.go1.10] cmd/go: run vet on packages with only cgo files

gopherbot pushed a commit that referenced this issue Mar 29, 2018
CgoFiles is not included in GoFiles, so we need to check both.

Fixes #24193

Change-Id: I6a67bd912e3d9a4be0eae8fa8db6fa8a07fb5df3
Reviewed-on: https://go-review.googlesource.com/99175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102785
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
ajeddeloh pushed a commit to ajeddeloh/ignition that referenced this issue Aug 29, 2018
Bump from 1.8, 1.9 to 1.10.4, 1.11. Pin to specifically 1.10.4 since
otherwise it implies 1.10.0 which has a go-vet bug which causes failures
(see golang/go#24193). Pinning to 1.11.0
doesn't seem to work so leave that as just 1.11.
ajeddeloh pushed a commit to ajeddeloh/ignition that referenced this issue Aug 31, 2018
Bump from 1.8, 1.9 to 1.10.4, 1.11. Pin to specifically 1.10.4 since
otherwise it implies 1.10.0 which has a go-vet bug which causes failures
(see golang/go#24193). Pinning to 1.11.0
doesn't seem to work so leave that as just 1.11.
ajeddeloh pushed a commit to ajeddeloh/ignition that referenced this issue Aug 31, 2018
Bump from 1.8, 1.9 to 1.10.4, 1.11. Pin to specifically 1.10.4 since
otherwise it implies 1.10.0 which has a go-vet bug which causes failures
(see golang/go#24193). Pinning to 1.11.0
doesn't seem to work so leave that as just 1.11.
ajeddeloh pushed a commit to ajeddeloh/ignition that referenced this issue Aug 31, 2018
Bump from 1.8, 1.9 to 1.10.4, 1.11. Pin to specifically 1.10.4 since
otherwise it implies 1.10.0 which has a go-vet bug which causes failures
(see golang/go#24193). Pinning to 1.11.0
doesn't seem to work so leave that as just 1.11.
@golang golang locked and limited conversation to collaborators Mar 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

5 participants