Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

running buffalo dev with sqlite3 database misses "-o" and "tmp/sqlite-build" packages #1114

Closed
aramadsanar opened this issue Jun 17, 2018 · 1 comment

Comments

@aramadsanar
Copy link

aramadsanar commented Jun 17, 2018

Hi all,

I am trying to start a buffalo project with sqlite3 as its database engine. There are no issues with starting the project and setting it up. However, I hit a problem upon running it with buffalo dev command. The error messages are cryptic enough and google search does nothing to help me on this issue :(

My buffalo installation are with sqlite enabled tag, and I am running this on Linux Mint 18.3 Cinnamon Sarah. The details of the error are enclosed below (with username redacted for privacy):

Steps to Reproduce the Problem

  1. buffalo new project_name --db-type sqlite3 //create the project with sqlite3 db engine
  2. buffalo setup //setup the project
  3. buffalo dev //run the project

Expected Behavior

I expect the project to run happily without any problem since the required packages are installed (at least what I think of)

Actual Behavior

I got this cryptic error message instead:

buffalo: 2018/06/17 15:24:47 === Error! ===
buffalo: 2018/06/17 15:24:47 === exit status 1
can't load package: package -o: cannot find package "-o" in any of:
	/usr/local/go/src/-o (from $GOROOT)
	/home/john-doe/go/src/-o (from $GOPATH)
can't load package: package tmp/tesqlite-build: cannot find package "tmp/tesqlite-build" in any of:
	/usr/local/go/src/tmp/tesqlite-build (from $GOROOT)
	/home/john-doe/go/src/tmp/tesqlite-build (from $GOPATH)
 ===

Info

Here is my buffalo info

### Buffalo Version
v0.12.0

### App Information
Pwd=/home/john-doe/go/src/myprojects/tesqlite
Root=/home/john-doe/go/src/myprojects/tesqlite
GoPath=/home/john-doe/go
Name=tesqlite
Bin=bin/tesqlite
PackagePkg=myprojects/tesqlite
ActionsPkg=myprojects/tesqlite/actions
ModelsPkg=myprojects/tesqlite/models
GriftsPkg=myprojects/tesqlite/grifts
VCS=git
WithPop=true
WithSQLite=true
WithDep=false
WithWebpack=true
WithYarn=true
WithDocker=true
WithGrifts=true

### Go Version
go version go1.10.3 linux/amd64

### Go Env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/john-doe/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/john-doe/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build040157634=/tmp/go-build -gno-record-gcc-switches"

### Node Version
v9.6.1

### NPM Version
5.6.0

┌────────────────────────────────────────────────────────────────┐
│                    npm update check failed                     │
│              Try running with sudo or get access               │
│              to the local update config store via              │
│ sudo chown -R $USER:$(id -gn $USER) /home/john-doe/.config │
└────────────────────────────────────────────────────────────────┘

### Yarn Version
1.7.0

### PostgreSQL Version
PostgreSQL Not Found

### MySQL Version
mysql  Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using  EditLine wrapper

### SQLite Version
3.11.0 2016-02-15 17:29:24 3d862f207e3adc00f78066799ac5a8c282430a5f

### Dep Version
could not find a Gopkg.toml file

### Dep Status
could not find a Gopkg.toml file

Thanks in Advance :)

@RedPh0enix
Copy link

RedPh0enix commented Jun 20, 2018

Likely to be associated with the requirement for quotes around multiple tags - ie:
$ go build -v -i -tags development sqlite
can't load package: package sqlite: cannot find package "sqlite" in any of:
/usr/local/go/src/sqlite (from $GOROOT)
...

As opposed to:
$ go build -v -i -tags "development sqlite"
.. or
$ go build -v -i -tags development -tags sqlite

Quick hack to fix:
edit github.com/gobuffalo/buffalo/buffalo/cmd/dev.go, and replace startDevServer as follows:

func startDevServer(ctx context.Context) error {
        cfgFile := "./.buffalo.dev.yml"
        if _, err := os.Stat(cfgFile); err != nil {
                err = rg.Run("./", map[string]interface{}{
                        "name": "buffalo",
                })
                if err != nil {
                        return err
                }
        }
        c := &refresh.Configuration{}
        if err := c.Load(cfgFile); err != nil {
                return err
        }
        c.Debug = devOptions.Debug
        tags := []string{"-tags","development"}
        if b, err := ioutil.ReadFile("database.yml"); err == nil {
                if bytes.Contains(b, []byte("sqlite")) {
                        tags = append(tags, "-tags")
                        tags = append(tags, "sqlite")
                }
        }
        c.BuildFlags = append(c.BuildFlags, tags...)
        r := refresh.NewWithContext(c, ctx)
        return r.Start()
}

cd into github.com/gobuffalo/buffalo/buffalo/
go build
go install

Things should work from there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants