gobuffalo / pop

A Tasty Treat For All Your Database Needs
MIT License
1.44k stars 243 forks source link

Brand new generated app broken with MySQL #344

Closed joshrendek closed 5 years ago

joshrendek commented 5 years ago

Description

buffalo build fails with a code generation error on new/empty projects.

buffalo dev still works.

go build -o testing still works.

Steps to Reproduce the Problem

Create a new project:

buffalo new testing -f --api --db-type=mysql
cd testing
buffalo build

Error:

ERRO[0002] Error: /Users/myuser/go/src/testing/a/database.go:17:27: expected ';', found url

database.yml

development:
  dialect: "mysql"
  database: "testing_development"
  host: "localhost"
  port: "3306"
  user: "root"
  password: "root"

test:
  dialect: "mysql"
  #
  # You can use a single URL string for the same configuration:
  #
  #url: "mysql://root:root@(localhost:3306)/testing_test?parseTime=true&multiStatements=true&readTimeout=3s"
  #
  # Note that if you use `url`, other configurations are silently ignored.
  # In this case, the URL must contain all required connection parameters.
  #
  database: "testing_test"
  host: "localhost"
  port: "3306"
  user: "root"
  password: "root"

production:
  #
  # You can also use environmental variables to override values in this config.
  #
  #url: {{envOr "DATABASE_URL" "mysql://root:root@(localhost:3306)/testing_production?parseTime=true&multiStatements=true&readTimeout=3s"}}
  #
  dialect: "mysql"
  database: "testing_production"
  host: {{envOr "DATABASE_HOST" "localhost"}}
  port: {{envOr "DATABASE_PORT" "3306"}}
  user: {{envOr "DATABASE_USER" "root"}}
  password: {{envOr "DATABASE_PASSWORD" "root"}}
  #
  # And you can also override connection parameters by setting it under options.
  #
  #options:
  #  parseTime: true
  #  multiStatements: true
  #  readTimeout: 3s
  #  encoding: "utf8mb4_general_ci"
  #
  # CAUTION!
  #   `parseTime` and` multiStatements` must be set to `true` to work properly.
  #   If you are not sure, do not change (or set) these values.

Expected Behavior

buffalo build should work and build the binary.

Actual Behavior

It errors out. A similar project but using the postgres works fine for all cases (buffalo build, go build, dev, etc)

Info

``` ### Buffalo Version v0.13.12 ### App Information Pwd=/Users/myuser/go/src/myproject/testing Root=/Users/myuser/go/src/myproject/testing GoPath=/Users/myuser/go Name=testing Bin=bin/testing PackagePkg=myproject/testing ActionsPkg=myproject/testing/actions ModelsPkg=myproject/testing/models GriftsPkg=myproject/testing/grifts VCS=git WithPop=true WithSQLite=false WithDep=false WithWebpack=false WithYarn=false WithDocker=true WithGrifts=true WithModules=false ### Go Version go version go1.11 darwin/amd64 ### Go Env GOARCH="amd64" GOBIN="" GOCACHE="/Users/myuser/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/myuser/go" GOPROXY="" GORACE="" GOROOT="/usr/local/Cellar/go/1.11/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5g/8ym14d1505l_fzzwk8cg27hr0000gn/T/go-build566705124=/tmp/go-build -gno-record-gcc-switches -fno-common" ### Node Version v10.6.0 ### NPM Version 6.1.0 ### Yarn Version 1.9.4 ### PostgreSQL Version PostgreSQL Not Found ### MySQL Version mysql Ver 15.1 Distrib 10.3.8-MariaDB, for osx10.13 (x86_64) using readline 5.1 ### SQLite Version 3.24.0 2018-06-04 14:10:15 95fbac39baaab1c3a84fdfc82ccb7f42398b2e92f18a2a57bce1d4a713cbaapl ### Dep Version could not find a Gopkg.toml file ### Dep Status could not find a Gopkg.toml file ### go.mod module myproject/testing ```
rafsanchez commented 5 years ago

Is there any movement on this? This is impacting some of our production deployments. MySQL has a rather large install base so I'm struggling to understand why this isn't getting any attention.

markbates commented 5 years ago

This was fixed in buffalo v0.14.0-rc.1. It was fixed based on a ticket there.


Mark Bates On Feb 14, 2019, 7:05 PM -0500, Rafael Sanchez notifications@github.com, wrote:

Is there any movement on this? This is impacting some of our production deployments. MySQL has a rather large install base so I'm struggling to understand why this isn't getting any attention. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

stanislas-m commented 5 years ago

This should be fixed now that buffalo v0.14.0 is released.