英文:
Go test does not find package tests in Makefile
问题
我有以下的Makefile:
SHELL := /bin/bash
boot:
@go run main.go
test:
@go test ./...
test-conf:
@go test --verbose conf
test-httpd:
@go test --verbose ./httpd
.PHONY: test test-conf test-httpd
奇怪的是,make test
可以正常工作,但是 make test-conf
或者 make test-httpd
都会显示 "github.com/bodokaiser/foobar [no test files]"。
当我在工作目录中运行 go test ./conf
时,它可以正常工作 - 那么 Makefile 为什么不能工作呢?
我需要怎么做才能让 Makefile 中的 go test 与包一起正常工作?
PS:如果可能的话,我想避免在所有路径前面使用 $(pwd) 或其他东西...
英文:
I have following Makefile:
SHELL := /bin/bash
boot:
@go run main.go
test:
@go test ./...
test-conf:
@go test --verbose conf
test-httpd:
@go test --verbose ./httpd
.PHONY: test test-conf test-httpd
Strangely enough make test
works without problems however make test-conf
or make test-httpd
will both result in "github.com/bodokaiser/foobar [no test files]".
When I run go test ./conf
from the working dir it works - shouldn't the makefile work too then?
What do I need to do to get go test working with packages in a Makefile?
PS: I would like to avoid using $(pwd) or something in front of all paths if possible...
答案1
得分: 3
test-httpd
和test-conf
不起作用,因为你不能在go test
中使用--verbose
,只能使用-v
。
英文:
test-httpd
and test-conf
don't work, as you can't use --verbose
with go test
, only -v
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论