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

Comments

Projects
None yet
5 participants
@variadico
Copy link

commented Mar 1, 2018

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.

@ysmolsky

This comment has been minimized.

Copy link
Member

commented Mar 1, 2018

@andybons andybons added the NeedsFix 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

This comment has been minimized.

Copy link

commented Mar 7, 2018

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

@gopherbot gopherbot closed this in 709da95 Mar 7, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Mar 7, 2018

Reopening for 1.10.1.

@andybons

This comment has been minimized.

Copy link
Member

commented Mar 27, 2018

CL 99175 OK for Go 1.10.1

@gopherbot

This comment has been minimized.

Copy link

commented Mar 27, 2018

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

[release-branch.go1.10] cmd/go: run vet on packages with only cgo files
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>

@andybons andybons closed this Mar 29, 2018

ajeddeloh added a commit to ajeddeloh/ignition that referenced this issue Aug 29, 2018

travis: bump go versions
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 added a commit to ajeddeloh/ignition that referenced this issue Aug 31, 2018

travis: bump go versions
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 added a commit to ajeddeloh/ignition that referenced this issue Aug 31, 2018

travis: bump go versions
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 added a commit to ajeddeloh/ignition that referenced this issue Aug 31, 2018

travis: bump go versions
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.
You can’t perform that action at this time.