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

Most upvoted comments

I made a small discovery when trying to figure out where the issue comes from.

buffalo build creates an additional package called a in the projects root. This package contains a single go file aa.go with an import to github.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.plush

When I prevent the buffalo command line tool from deleting this file after generating it (by e.g. removing the write dependency on the a directory) the build completes without any issues and github.com/gobuffalo/flect v0.2.2 is added to go.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.