Open LeGEC opened 3 years ago
Some other issues show users confused by this message :
part of his issue is to have run go mod tidy
when no version of go was specified in the go.mod
he had
for some minor changes in go.sum
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: ad2847c7fa67b9debafccd5a08bacb12fc9031f1) 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
:https://github.com/prometheus/mysqld_exporter/blob/ad2847c7fa67b9debafccd5a08bacb12fc9031f1/Makefile.common#L120-L121
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 :https://github.com/prometheus/mysqld_exporter/blob/ad2847c7fa67b9debafccd5a08bacb12fc9031f1/Makefile.common#L205-L222
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 :