[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Understanding the internal behavior of DH_GOLANG_GO_GENERATE


When turning on DH_GOLANG_GO_GENERATE, my build fail. Here is what happened:

This is my `go:generate`:

grep go:generate *.go
ffcvt.go://go:generate sh -x ffcvt_cli.sh

It runs fine when I invoke it manually:

$ go generate -x
sh -x ffcvt_cli.sh
+ templateFile=...

When turning on DH_GOLANG_GO_GENERATE, my build fail with:

. . .
make[1]: Entering directory '/.../ffcvt'
        cd obj-x86_64-linux-gnu && go generate -v github.com/suntong/ffcvt
sh: 0: Can't open ffcvt_cli.sh
src/github.com/suntong/ffcvt/ffcvt.go:14: running "sh": exit status 127
dh_auto_build: cd obj-x86_64-linux-gnu && go generate -v
github.com/suntong/ffcvt returned exit code 1
make[1]: *** [debian/rules:9: override_dh_auto_build] Error 255
make[1]: Leaving directory '/.../ffcvt'
make: *** [debian/rules:17: binary] Error 2
. . .

My ffcvt_cli.sh resides right under src/github.com/suntong/ffcvt.
How can I make change to my setting so that it works for both manual
run and Debian build?


On Mon, Dec 30, 2019 at 12:48 AM Dmitry Smirnov <onlyjob@debian.org> wrote:
> On Monday, 30 December 2019 3:32:36 PM AEDT Tong Sun wrote:
> > So, hopefully I can leave the "config.go" as is, *for now*. OK?
> You may know specifics of this very package better but I disagree because re-
> building all generated files is required for build integrity and for best
> practice. There is nothing to loose if "go generate" does not break the build
> and maybe something to gain in case of changes that have potential to modify
> the generated files - even if such change is in the golang istelf or within
> the very library.
> If suddenly "go generate" stops to work then it will serve as an important
> indicator of breaking changes that you should know about.
> Re-building all pre-generated files is an important guarantee of DFSG
> compliance since all pre-built files must be possible to re-build from
> source.
> I therefore insist that all pre-built files must be re-built from source
> whenever possible. I can not recognise "we don't have to" and "I'd rather
> not" reasons as legitimate excuses. :)
> I hope it makes sense.
> --
> Best wishes,
>  Dmitry Smirnov.

Reply to: