buffalo: build fails with golang 1.16.0
Hello, I am trying to build by project with golang ~1.16beta1~ 1.16.0 (using the alpine based docker image) and I get the following error:
buffalo build -v
DEBU[2021-01-05T07:39:43Z] Step: e1807c46
DEBU[2021-01-05T07:39:43Z] Chdir: /test/xxx
DEBU[2021-01-05T07:39:43Z] File: /test/xxx/main.go
DEBU[2021-01-05T07:39:43Z] File: /test/xxx/a/aa.go
DEBU[2021-01-05T07:39:43Z] File: /test/xxx/buffalo_build_main.go
DEBU[2021-01-05T07:39:43Z] File: /test/xxx/migrations/.pop-tmp.md
DEBU[2021-01-05T07:39:43Z] Exec: go build -v -tags development -o bin/xxx
go: updates to go.mod needed; try 'go mod tidy' first
DEBU[2021-01-05T07:39:43Z] Rollback: main.go
DEBU[2021-01-05T07:39:43Z] File: /test/xxx/main.go
DEBU[2021-01-05T07:39:43Z] Delete: a/aa.go
DEBU[2021-01-05T07:39:43Z] Delete: buffalo_build_main.go
DEBU[2021-01-05T07:39:43Z] Delete: migrations/.pop-tmp.md
DEBU[2021-01-05T07:39:43Z] Exec: go mod tidy
Usage:
buffalo build [flags]
Aliases:
build, b, bill, install
Flags:
--clean-assets will delete public/assets before calling webpack
--dry-run runs the build 'dry'
--environment string set the environment for the binary (default "development")
-e, --extract-assets extract the assets and put them in a distinct archive
-h, --help help for build
--ldflags string set any ldflags to be passed to the go build
--mod string -mod flag for go build
-o, --output string set the name of the binary
-k, --skip-assets skip running webpack and building assets
--skip-build-deps skip building dependencies
--skip-template-validation skip validating templates
-s, --static build a static binary using --ldflags '-linkmode external -extldflags "-static"'
-t, --tags string compile with specific build tags
-v, --verbose print debugging information
ERRO[0000] Error: exit status 1
A strange thing is that echoing $? returns 255, not 1
Running go mod tidy does not solve the issue.
Running buffalo dev works fine
The project builds fine with golang 1.15.5 and the same buffalo versio (0.16.18)
What can I check to provide more useful infos/solve this ?
test repo: https://github.com/giulianozor/buffalotest
thanks
Update: running go get -u, buffalo fix buffalo update does not fix the issue
Update 2: if I run buffalo build --dry-run it seems to complete without error, but obviously no binary is produced
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (11 by maintainers)
Commits related to this issue
- Fix build issues with golang 1.16 (#2113) * Fix build issue #2074 * Stick with go 1.15 for compatibility Co-authored-by: Matthias Fasching <matthias.fasching@a52.eu> — committed to gobuffalo/buffalo by fasmat 3 years ago
- v0.16.24 (#2116) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`)... — committed to gobuffalo/buffalo by paganotoni 3 years ago
- v0.16.26 (#2120) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`)... — committed to gobuffalo/buffalo by paganotoni 3 years ago
- v0.16.27 (#2126) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`)... — committed to gobuffalo/buffalo by paganotoni 3 years ago
- v0.17.3 (#2140) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`) ... — committed to gobuffalo/buffalo by paganotoni 3 years ago
- v0.17.4 (#2155) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`) ... — committed to gobuffalo/buffalo by paganotoni 3 years ago
- v0.17.5 (#2165) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`) ... — committed to gobuffalo/buffalo by paganotoni 3 years ago
- Replace packr with embed fs (#2166) * v0.17.5 (#2165) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created... — committed to gobuffalo/buffalo by fasmat 3 years ago
- v0.18.0 (#2169) * adding direct version on the docker build * fixing plugin installation * Fix npm's package.json permissions (#2005) Changed created file permissions from 644 (`-w----r--`) ... — committed to gobuffalo/buffalo by paganotoni 3 years ago
I made a small discovery when trying to figure out where the issue comes from.
buffalo buildcreates an additional package calledain the projects root. This package contains a single go fileaa.gowith an import togithub.com/gobuffalo/flect. The template for the file can be found here: https://github.com/gobuffalo/buffalo/blob/master/genny/build/templates/a/aa.go.plushWhen I prevent the buffalo command line tool from deleting this file after generating it (by e.g. removing the write dependency on the
adirectory) the build completes without any issues andgithub.com/gobuffalo/flect v0.2.2is added togo.mod.So the issue introduced in 1.16 seems to be that go build detects a dependency on the flect package but when it tries to resolve this dependency the source file has already been deleted again, where 1.15 had no issues with.