gobuffalo / buffalo

Rapid Web Development w/ Go
http://gobuffalo.io
MIT License
8.09k stars 575 forks source link

Buffalo New Fails with "Cannot use promoted field in struct literal of type initgen.Options" #1696

Closed mister-turtle closed 5 years ago

mister-turtle commented 5 years ago

Description

When trying to create a new buffalo web application, the process fails with the following:

$ buffalo new webapp --skip-pop
DEBU[2019-06-11T15:54:47+01:00] Step: fc7c3391
DEBU[2019-06-11T15:54:47+01:00] Chdir: /root/go/src/tmp/webapp
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/.codeclimate.yml
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/.env
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/README.md
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/actions/actions_test.go
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/actions/app.go
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/actions/home.go
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/actions/home_test.go
DEBU[2019-06-11T15:54:47+01:00] File: /root/go/src/tmp/webapp/actions/render.go
DEBU[2019-06-11T15:54:48+01:00] File: /root/go/src/tmp/webapp/fixtures/sample.toml
DEBU[2019-06-11T15:54:48+01:00] File: /root/go/src/tmp/webapp/grifts/init.go
DEBU[2019-06-11T15:54:48+01:00] File: /root/go/src/tmp/webapp/inflections.json
DEBU[2019-06-11T15:54:48+01:00] File: /root/go/src/tmp/webapp/main.go
DEBU[2019-06-11T15:54:48+01:00] File: /root/go/src/tmp/webapp/config/buffalo-app.toml
DEBU[2019-06-11T15:54:48+01:00] Step: 031521df
DEBU[2019-06-11T15:54:48+01:00] Chdir: /root/go/src/tmp/webapp
DEBU[2019-06-11T15:54:48+01:00] Step: b5e948ad
DEBU[2019-06-11T15:54:48+01:00] Chdir: /root/go/src/tmp/webapp
DEBU[2019-06-11T15:54:48+01:00] File: /root/go/src/tmp/webapp/.buffalo.dev.yml
DEBU[2019-06-11T15:54:48+01:00] Step: f3b37650
DEBU[2019-06-11T15:54:48+01:00] Chdir: /root/go/src/tmp/webapp
DEBU[2019-06-11T15:54:48+01:00] Exec: go get github.com/gobuffalo/buffalo-plugins
# github.com/gobuffalo/buffalo-plugins/genny/plugin
../../github.com/gobuffalo/buffalo-plugins/genny/plugin/plugin.go:45:3: cannot use promoted field Options.MainFile in struct literal of type initgen.Options
../../github.com/gobuffalo/buffalo-plugins/genny/plugin/plugin.go:46:3: cannot use promoted field Options.Root in struct literal of type initgen.Options
Usage:
  buffalo new [name] [flags]

Flags:
      --api                  skip all front-end code and configure for an API server
      --ci-provider string   specify the type of ci file you would like buffalo to generate [none, travis, gitlab-ci] (default "none")
      --config string        config file (default is $HOME/.buffalo.yaml)
      --db-type string       specify the type of database you want to use [cockroach, mysql, postgres, sqlite3] (default "postgres")
      --docker string        specify the type of Docker file to generate [none, multi, standard] (default "multi")
  -d, --dry-run              dry run
  -f, --force                delete and remake if the app already exists
  -h, --help                 help for new
      --module string        specify the root module (package) name. [defaults to 'automatic']
      --skip-config          skips using the config file
      --skip-pop             skips adding pop/soda to your app
      --skip-webpack         skips adding Webpack to your app
      --skip-yarn            use npm instead of yarn for frontend dependencies management
      --vcs string           specify the Version control system you would like to use [none, git, bzr] (default "git")
  -v, --verbose              verbosely print out the go get commands
      --with-dep             adds github.com/golang/dep to your app

ERRO[0000] Error: exit status 2

Note: This also fails using the instructions and placing the project under $GOPATH/src/github.com/$USER.

Steps to Reproduce the Problem

Instructions from https://gobuffalo.io/en/docs/getting-started/installation

  1. $ wget https://github.com/gobuffalo/buffalo/releases/download/v0.14.5/buffalo_0.14.5_linux_amd64.tar.gz
  2. $ tar -xvzf buffalo_0.14.5_linux_amd64.tar.gz
  3. $ mv buffalo /usr/local/bin/buffalo
  4. cd /root/go/src/tmp/
  5. buffalo new webapp --skip-pop

Before anyone cringes at root, this is a Kali box and I was trying to knock together a quick web app framework for something.

Info

``` root@mpkali:~# buffalo info -> Go: Checking installation ✓ The `go` executable was found on your system at: /usr/bin/go -> Go: Checking minimum version requirements ✓ Your version of Go, 1.12.5, 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 /root/go/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, v10.15.2, 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, 5.8.0, does not meet the minimum requirements. Minimum versions of NPM are: * >=6.0.0 * >=7.0.0 For help setting up your NPM environment please follow the instructions for you platform at: https://docs.npmjs.com/getting-started/configuring-your-local-environment -> 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.27.2, 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 fo r 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.5, meets the minimum requirements. -> Buffalo: Application Details Pwd /root Root /root GoPath /root/go PackagePkg root ActionsPkg root/actions ModelsPkg root/models GriftsPkg root/grifts WithModules true Name root Bin bin/root VCS WithPop false WithSQLite false WithDep false WithWebpack false WithNodeJs false WithYarn false WithDocker false WithGrifts false AsWeb true AsAPI false InApp false PackageJSON {map[]} ```
triptips-top commented 5 years ago

我遇到了相同的问题,就在刚刚。

mister-turtle commented 5 years ago

It appears this commit https://github.com/gobuffalo/release/commit/a8e775c846ffb310a6880d0a1ae0b9b0efed2efb#diff-0ab6db3e481a4816176661f1b7c5767c removed "MainFile" and "Root" from the Options struct, which are still being used by buffalo-plugins/genny/plugin.go
Edit: Should this be moved to gobuffalo/release, or gobuffalo/buffalo-plugins instead?

jay13jay commented 5 years ago

I am having this issue too and can provide additional data if required.

jay13jay commented 5 years ago

Buffalo plugins Readme is stating that the plugins have been moved into the main package, I haven't looked at the actual code yet, but if that's the case, shouldn't buffalo new stop running go get on the plugins package?

markbates commented 5 years ago

Yes, a PR would be very welcome.