gobuffalo/buffalo

Unable to build after upgrade (0.14 to 0.17)

Closed this issue · 7 comments

Description

When trying to build using buffalo build, it errors out without letting me know what's wrong

Steps to Reproduce the Problem

Please describe in painful detail what you did (so others can play along with you) to get to this point. This includes things like the exact command(s) you used, or the curl command you used, that sort of thing.

  1. Have a buffalo app
  2. Attempt to build with buffalo build --verbose --environment production

I can reproduce this even with a freshly created app:

 buffalo new example
 cd example/
 git init .
 git add .
 git commit -am "test"
 buffalo build
 buffalo build --verbose --environment production

Note: Creating a new app also errors out (but does create the app. How complete that is, I don't know). See #2160

Expected Behavior

It should build the app

Actual Behavior

It doesn't build and the command outputs the following:

DEBU[2021-11-13T01:37:17Z] Step: 0481ef9c
DEBU[2021-11-13T01:37:17Z] Chdir: <go path>/src/<dir>
DEBU[2021-11-13T01:37:17Z] File: <go path>/src/<dir>/main.go
DEBU[2021-11-13T01:37:17Z] File: <go path>/src/<dir>/a/aa.go
DEBU[2021-11-13T01:37:17Z] File: <go path>/src/<dir>/buffalo_build_main.go
DEBU[2021-11-13T01:37:17Z] File: <go path>/src/<dir>/migrations/.pop-tmp.md
DEBU[2021-11-13T01:37:17Z] File: <go path>/src/<dir>/a/inflections.json
DEBU[2021-11-13T01:37:17Z] File: <go path>/src/<dir>/a/database.yml
DEBU[2021-11-13T01:37:17Z] Exec: go build -v -tags production -o bin/scheduler
go: updates to go.mod needed; to update it:
        go mod tidy
DEBU[2021-11-13T01:37:17Z] Rollback: main.go
DEBU[2021-11-13T01:37:17Z] File: <go path>/src/<dir>/main.go
DEBU[2021-11-13T01:37:17Z] Delete: a/aa.go
DEBU[2021-11-13T01:37:17Z] Delete: a/database.yml
DEBU[2021-11-13T01:37:17Z] Delete: a/inflections.json
DEBU[2021-11-13T01:37:17Z] Delete: buffalo_build_main.go
DEBU[2021-11-13T01:37:17Z] Delete: migrations/.pop-tmp.md
DEBU[2021-11-13T01:37:17Z] 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                         

Info

Please run buffalo info and paste the information below where it says "PASTE_HERE".

-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/lib/go/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.12.3, meets the minimum requirements.

-> Go: Checking GOPATH
✓ You are using Go Modules, so no need to worry about the GOPATH.

-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.

-> Go: Checking PATH
✓ Your PATH contains <GoPath>/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v15.6.0, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.13.1, meets the minimum requirements.

-> Yarn: Checking installation
✘ The `yarnpkg` executable could not be found on your system.
For help setting up your Yarn environment please follow the instructions for you platform at:

https://yarnpkg.com/en/docs/install

-> PostgreSQL: Checking installation
✘ The `postgres` executable could not be found on your system.
For help setting up your Postgres environment please follow the instructions for you platform at:

https://www.postgresql.org/download/

-> MySQL: Checking installation
✓ The `mysql` executable was found on your system at: /usr/bin/mysql

-> MySQL: Checking minimum version requirements
✓ Your version of MySQL, 15.1, meets the minimum requirements.

-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /usr/bin/sqlite3

-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.34.0, meets the minimum requirements.

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo: Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo

-> Buffalo: Checking minimum version requirements
✓ Your version of Buffalo, v0.14.10, meets the minimum requirements.

-> Buffalo: Application Details
Pwd         <go path>/src/<dir>
Root        <go path>/src/<dir>
GoPath      <go path>
PackagePkg  <dir>
ActionsPkg  <dir>/actions
ModelsPkg   <dir>/models
GriftsPkg   <dir>/grifts
WithModules true
Name        scheduler
Bin         bin/scheduler
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack false
WithNodeJs  false
WithYarn    false
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[]}

-> Buffalo: config/buffalo-app.toml
name = "scheduler"
bin = "bin/scheduler"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = false
with_nodejs = false
with_yarn = false
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop"

-> Buffalo: go.mod
module <dir>

go 1.16

require (
        github.com/aws/aws-sdk-go v1.42.3
        github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051 // indirect
        github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
        github.com/felixge/httpsnoop v1.0.2 // indirect
        github.com/form3tech-oss/jwt-go v3.2.5+incompatible
        github.com/franela/goblin v0.0.0-20200611003024-99f9a98191cf
        github.com/go-sql-driver/mysql v1.6.0 // indirect
        github.com/gobuffalo/buffalo v0.17.4
        github.com/gobuffalo/buffalo-pop v1.23.1
        github.com/gobuffalo/envy v1.10.1
        github.com/gobuffalo/events v1.4.2 // indirect
        github.com/gobuffalo/fizz v1.13.0 // indirect
        github.com/gobuffalo/helpers v0.6.3 // indirect
        github.com/gobuffalo/logger v1.0.6
        github.com/gobuffalo/mw-contenttype v0.0.0-20190224202710-36c73cc938f3
        github.com/gobuffalo/mw-forcessl v0.0.0-20200131175327-94b2bd771862
        github.com/gobuffalo/mw-paramlogger v1.0.0
        github.com/gobuffalo/nulls v0.4.1
        github.com/gobuffalo/packd v1.0.1 // indirect
        github.com/gobuffalo/plush/v4 v4.1.8 // indirect
        github.com/gobuffalo/pop v4.13.1+incompatible
        github.com/gobuffalo/validate v2.0.4+incompatible
        github.com/gobuffalo/validate/v3 v3.3.1 // indirect
        github.com/gobuffalo/x v0.1.0
        github.com/google/uuid v1.3.0
        github.com/jackc/pgx/v4 v4.13.0 // indirect
        github.com/lib/pq v1.10.4 // indirect
        github.com/markbates/grift v1.5.0
        github.com/markbates/refresh v1.12.0 // indirect
        github.com/mattn/go-colorable v0.1.11 // indirect
        github.com/robfig/cron v1.2.0
        github.com/rs/cors v1.8.0
        github.com/unrolled/secure v1.0.9
        golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa // indirect
        golang.org/x/net v0.0.0-20211111160137-58aab5ef257a // indirect
        golang.org/x/sys v0.0.0-20211112164355-7580c6e521dc // indirect
        golang.org/x/text v0.3.7 // indirect
        gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
)

replace golang.org/x/text v0.3.2 => golang.org/x/text v0.3.3

From your details I see you are using Go 1.12.3, the current version of Buffalo only supports Go 1.16.x and Go 1.17.x. Can you retry with an updated installation?

Additionally you seem to be using a quite outdated version of buffalo (v0.14.10). Could you retry with a more recent version (v0.17.x)?

I thought I had updated buffalo with buffalo update, but now I read it more clearly

In the meantime I've upgraded go as well and now, at your suggestion, I upgraded buffalo (properly now!) but I still have the same issue:

-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/lib/go/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.17.3, meets the minimum requirements.

-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.

-> Go: Checking PATH
✓ Your PATH contains <go path>/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v15.6.0, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.13.1, meets the minimum requirements.

-> Yarn: Checking installation
✘ The `yarnpkg` executable could not be found on your system.
For help setting up your Yarn environment please follow the instructions for you platform at:

https://yarnpkg.com/en/docs/install

-> PostgreSQL: Checking installation
✘ The `postgres` executable could not be found on your system.
For help setting up your Postgres environment please follow the instructions for you platform at:

https://www.postgresql.org/download/

-> MySQL: Checking installation
✓ The `mysql` executable was found on your system at: /usr/bin/mysql

-> MySQL: Checking minimum version requirements
✓ Your version of MySQL, 15.1, meets the minimum requirements.

-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /usr/bin/sqlite3

-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.34.0, meets the minimum requirements.

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo

-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.17.6, meets the minimum requirements.

-> Buffalo: Application Details
Pwd         <go path>/src/<dir>
Root        <go path>/src/<dir>
GoPath      <go path>
PackagePkg  <dir>
ActionsPkg  <dir>/actions
ModelsPkg   <dir>/models
GriftsPkg   <dir>/grifts
WithModules true
Name        scheduler
Bin         bin/scheduler
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack false
WithNodeJs  false
WithYarn    false
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[]}

-> Buffalo: config/buffalo-app.toml
name = "scheduler"
bin = "bin/scheduler"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = false
with_nodejs = false
with_yarn = false
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop"

-> Buffalo: go.mod
module <dir>

go 1.17

require (
        github.com/aws/aws-sdk-go v1.42.4
        github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051 // indirect
        github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
        github.com/felixge/httpsnoop v1.0.2 // indirect
        github.com/form3tech-oss/jwt-go v3.2.5+incompatible
        github.com/franela/goblin v0.0.0-20200611003024-99f9a98191cf
        github.com/go-sql-driver/mysql v1.6.0 // indirect
        github.com/gobuffalo/buffalo v0.17.4
        github.com/gobuffalo/buffalo-pop v1.23.1
        github.com/gobuffalo/envy v1.10.1
        github.com/gobuffalo/events v1.4.2 // indirect
        github.com/gobuffalo/fizz v1.13.0 // indirect
        github.com/gobuffalo/helpers v0.6.3 // indirect
        github.com/gobuffalo/logger v1.0.6
        github.com/gobuffalo/mw-contenttype v0.0.0-20190224202710-36c73cc938f3
        github.com/gobuffalo/mw-forcessl v0.0.0-20200131175327-94b2bd771862
        github.com/gobuffalo/mw-paramlogger v1.0.0
        github.com/gobuffalo/nulls v0.4.1
        github.com/gobuffalo/packd v1.0.1 // indirect
        github.com/gobuffalo/plush/v4 v4.1.8 // indirect
        github.com/gobuffalo/pop v4.13.1+incompatible
        github.com/gobuffalo/validate v2.0.4+incompatible
        github.com/gobuffalo/validate/v3 v3.3.1 // indirect
        github.com/gobuffalo/x v0.1.0
        github.com/google/uuid v1.3.0
        github.com/jackc/pgx/v4 v4.13.0 // indirect
        github.com/lib/pq v1.10.4 // indirect
        github.com/markbates/grift v1.5.0
        github.com/markbates/refresh v1.12.0 // indirect
        github.com/mattn/go-colorable v0.1.11 // indirect
        github.com/robfig/cron v1.2.0
        github.com/rs/cors v1.8.0
        github.com/unrolled/secure v1.0.9
        golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa // indirect
        golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
        golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02 // indirect
        golang.org/x/text v0.3.7 // indirect
        gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
)

require (
        github.com/BurntSushi/toml v0.4.1 // indirect
        github.com/Masterminds/semver/v3 v3.1.1 // indirect
        github.com/aymerick/douceur v0.2.0 // indirect
        github.com/dustin/go-humanize v1.0.0 // indirect
        github.com/fatih/color v1.13.0 // indirect
        github.com/fatih/structs v1.1.0 // indirect
        github.com/fsnotify/fsnotify v1.5.1 // indirect
        github.com/gobuffalo/flect v0.2.4 // indirect
        github.com/gobuffalo/genny v0.6.0 // indirect
        github.com/gobuffalo/github_flavored_markdown v1.1.1 // indirect
        github.com/gobuffalo/meta v0.3.1 // indirect
        github.com/gobuffalo/pop/v5 v5.3.4 // indirect
        github.com/gobuffalo/tags/v3 v3.1.1 // indirect
        github.com/gofrs/uuid v4.1.0+incompatible // indirect
        github.com/gorilla/css v1.0.0 // indirect
        github.com/gorilla/handlers v1.5.1 // indirect
        github.com/gorilla/mux v1.8.0 // indirect
        github.com/gorilla/securecookie v1.1.1 // indirect
        github.com/gorilla/sessions v1.2.1 // indirect
        github.com/inconshreveable/mousetrap v1.0.0 // indirect
        github.com/jackc/chunkreader/v2 v2.0.1 // indirect
        github.com/jackc/pgconn v1.10.0 // indirect
        github.com/jackc/pgio v1.0.0 // indirect
        github.com/jackc/pgpassfile v1.0.0 // indirect
        github.com/jackc/pgproto3/v2 v2.1.1 // indirect
        github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
        github.com/jackc/pgtype v1.8.1 // indirect
        github.com/jmespath/go-jmespath v0.4.0 // indirect
        github.com/jmoiron/sqlx v1.3.4 // indirect
        github.com/joho/godotenv v1.4.0 // indirect
        github.com/karrick/godirwalk v1.16.1 // indirect
        github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
        github.com/luna-duclos/instrumentedsql v1.1.3 // indirect
        github.com/markbates/oncer v1.0.0 // indirect
        github.com/markbates/safe v1.0.1 // indirect
        github.com/markbates/sigtx v1.0.0 // indirect
        github.com/mattn/go-isatty v0.0.14 // indirect
        github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
        github.com/microcosm-cc/bluemonday v1.0.16 // indirect
        github.com/mitchellh/go-homedir v1.1.0 // indirect
        github.com/monoculum/formam v0.0.0-20210523135142-1af3317b7b9b // indirect
        github.com/pkg/errors v0.9.1 // indirect
        github.com/rogpeppe/go-internal v1.8.0 // indirect
        github.com/sergi/go-diff v1.2.0 // indirect
        github.com/sirupsen/logrus v1.8.1 // indirect
        github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect
        github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
        github.com/spf13/cobra v1.2.1 // indirect
        github.com/spf13/pflag v1.0.5 // indirect
        golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
        golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
        gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
        gopkg.in/yaml.v2 v2.4.0 // indirect
)

replace golang.org/x/text v0.3.2 => golang.org/x/text v0.3.3

When I build:

$ buffalo build --verbose --environment=production
DEBU[2021-11-13T20:21:40Z] Step: 2a061810
DEBU[2021-11-13T20:21:40Z] Chdir: <go path>/src/<dir>
DEBU[2021-11-13T20:21:40Z] File: <go path>/src/<dir>/main.go
DEBU[2021-11-13T20:21:40Z] File: <go path>/src/<dir>/a/inflections.json
DEBU[2021-11-13T20:21:40Z] File: <go path>/src/<dir>/a/database.yml
DEBU[2021-11-13T20:21:40Z] Exec: go get -d
DEBU[2021-11-13T20:22:10Z] Exec: go build -v -tags production -o bin/scheduler
# <dir>
runtime.main_main·f: function main is undeclared in the main package
DEBU[2021-11-13T20:22:12Z] Rollback: main.go
DEBU[2021-11-13T20:22:12Z] File: <go path>/src/<dir>/main.go
DEBU[2021-11-13T20:22:12Z] Delete: a/database.yml
DEBU[2021-11-13T20:22:12Z] Delete: a/inflections.json
DEBU[2021-11-13T20:22:12Z] 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[0031] Error: exit status 2                         
(╯°□°)╯︵ ┻━┻

The error you experience now is a bug that was introduced with the most recent version (v0.17.6) of buffalo. A fix is currently pending review and should soon be available.

In the meantime you can use v0.17.5 to avoid this error:

go install github.com/gobuffalo/cli/cmd/buffalo@v0.17.5

The problem is not buffalo build but buffalo new. Recreate your project and then call build again, then it should work 😊

PS: the warnings you get with buffalo new in versions before v0.17.6 are safe to ignore. v0.17.6 should have fixed those but introduced a different issue that should soon be fixed.

Ah dang!

I tried using v0.17.5 but I'm still unable to build.

I'm going to try to recreate the project and move the files over... I'll edit this with the results.

EDIT: Recreating the project works!
Took quite a bit of work but we got there.

This means, though, that upgrading from 0.14 to 0.17 doesn't work though?

You can try to use the buffalo fix command to upgrade your codebase from a previous version to the current version of gobuffalo. This is just a helper though and might not be able to fix all issues that come up (especially if you skip a few versions during the upgrade).

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 5 days with no activity.