You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux legec-laptop 5.4.0-74-generic #83-Ubuntu SMP Sat May 8 02:35:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
mysqld_exporter version: output of mysqld_exporter --version
mysqld_exporter, version 0.13.0 (branch: master, revision: ad2847c)
build date: 20210616-12:56:48
go version: go1.16.3
platform: linux/amd64
MySQL server version
n.a.
What did you do that produced an error?
make
What did you expect to see?
a successful build
What did you see instead?
>> running check for unused/missing packages in go.mod
GO111MODULE=on go mod tidy
...
<a long diff, see below>
...
make: *** [Makefile.common:214: common-unused] Error 1
common-all: precheck style check_license lint unused build test
The unused target runs go mod tidy (when GO11MODULE is set, which is the default choice), and runs a git diff check on files go.mod, go.sum and vendor/ to confirm that nothing has changed :
@echo ">> running check for unused/missing packages in go.mod"
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
ifeq (,$(wildcard vendor))
@git diff --exit-code -- go.sum go.mod
else
@echo ">> running check for unused packages in vendor/"
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
@git diff --exit-code -- go.sum go.mod vendor/
endif
endif
endif
The issues are :
there is no message explaining to the user what to make of this output
this action does modify go.mod and go.sum, so running make build afterwards, for example, will not produce the same binary as what the end user would expect
interestingly, this makes the make action depend on the presence of git (not a big dependency issue, but still), and this action will not work if you aren't within a git clone of the project (no git archive tarball for you)
About the git part : a colleague of mine had deleted the .git/ directory after cloning, which turned the command git diff --exit-code -- go.sum go.mod into a diff between the two files go.sum and go.mod :
which lead to some unhelpful head scratching before figuring out what it was.
From what I understand, this action is useful for maintainers of the project, but pretty unhelpful for users who just wish to clone and use it, and makes for a weird blocker.
Possible suggestions :
remove unused from default make targets, add some other action to check for unused (another make target ? a script ? a pre-push hook ? ...)
keep unused in default targets, but instruct regular users to run make build && make test in Readme.md
additionally :
display a more helpful message when this action fails (non go users will have a hard time understanding what is displayed, and what to make out of it)
The text was updated successfully, but these errors were encountered:
Some other issues show users confused by this message :
#534 - build failed on FreeBSD
part of his issue is to have run go mod tidy when no version of go was specified in the go.mod he had
#532 - Build failed on golang docker image
for some minor changes in go.sum
#431 - Build failed on centos7.6
interestingly, the only changes mentioned in the diff are not changes in the modules, but changes in the order of the lines within the vendor/modules.txt file
Host operating system: output of
uname -a
Linux legec-laptop 5.4.0-74-generic #83-Ubuntu SMP Sat May 8 02:35:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
mysqld_exporter version: output of
mysqld_exporter --version
mysqld_exporter, version 0.13.0 (branch: master, revision: ad2847c)
build date: 20210616-12:56:48
go version: go1.16.3
platform: linux/amd64
MySQL server version
n.a.
What did you do that produced an error?
What did you expect to see?
a successful build
What did you see instead?
The default make target includes
unused
:mysqld_exporter/Makefile.common
Lines 120 to 121 in ad2847c
The
unused
target runsgo mod tidy
(whenGO11MODULE
is set, which is the default choice), and runs agit diff
check on filesgo.mod
,go.sum
andvendor/
to confirm that nothing has changed :mysqld_exporter/Makefile.common
Lines 205 to 222 in ad2847c
The issues are :
go.mod
andgo.sum
, so runningmake build
afterwards, for example, will not produce the same binary as what the end user would expectmake
action depend on the presence ofgit
(not a big dependency issue, but still), and this action will not work if you aren't within a git clone of the project (nogit archive
tarball for you)About the git part : a colleague of mine had deleted the
.git/
directory after cloning, which turned the commandgit diff --exit-code -- go.sum go.mod
into a diff between the two filesgo.sum
andgo.mod
:which lead to some unhelpful head scratching before figuring out what it was.
From what I understand, this action is useful for maintainers of the project, but pretty unhelpful for users who just wish to clone and use it, and makes for a weird blocker.
Possible suggestions :
unused
from defaultmake
targets, add some other action to check forunused
(another make target ? a script ? a pre-push hook ? ...)unused
in default targets, but instruct regular users to runmake build && make test
in Readme.mdadditionally :
The text was updated successfully, but these errors were encountered: