Skip to content

Commit

Permalink
dependency diet (#59)
Browse files Browse the repository at this point in the history
* dependency diet

* Bump Go version for Azure tests

* Fix MySQL version scan

Co-authored-by: Stanislas Michalak <[email protected]>
  • Loading branch information
markbates and stanislas-m authored Feb 11, 2020
1 parent e65fa5e commit beab577
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 91 deletions.
24 changes: 8 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TAGS ?= "sqlite"
GO_BIN ?= "go"

install: packr
install:
$(GO_BIN) install -tags ${TAGS} -v .
make tidy

Expand All @@ -16,18 +16,18 @@ deps:
$(GO_BIN) get -tags ${TAGS} -t ./...
make tidy

build: packr
build:
$(GO_BIN) build -v .
make tidy

test: packr
test:
./test.sh
make tidy

ci-deps: packr
ci-deps:
$(GO_BIN) get -tags ${TAGS} -t ./...

ci-test: packr
ci-test:
$(GO_BIN) test -tags ${TAGS} -race ./...

lint:
Expand All @@ -47,20 +47,12 @@ endif
make install
make tidy

release-test: packr
release-test:
$(GO_BIN) test -tags ${TAGS} -race ./...
make tidy

release:
$(GO_BIN) get github.com/gobuffalo/release
make tidy
release -y -f version.go
make tidy

packr:
$(GO_BIN) get github.com/gobuffalo/packr/v2/packr2
packr2
make tidy



release -y -f version.go --skip-packr
make tidy
59 changes: 28 additions & 31 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
strategy:
matrix:
# SQLite3
go 1.12 (on) sqlite:
go_version: "1.12"
go 1.13 (on) sqlite:
go_version: "1.13"
GO111MODULE: "on"
SODA_DIALECT: "sqlite"
go 1.12 (off) sqlite:
go_version: "1.12"
go 1.13 (off) sqlite:
go_version: "1.13"
GO111MODULE: "off"
SODA_DIALECT: "sqlite"
steps:
Expand All @@ -28,12 +28,12 @@ jobs:
strategy:
matrix:
# SQLite3
go 1.12 (on) sqlite:
go_version: "1.12"
go 1.13 (on) sqlite:
go_version: "1.13"
GO111MODULE: "on"
SODA_DIALECT: "sqlite"
go 1.12 (off) sqlite:
go_version: "1.12"
go 1.13 (off) sqlite:
go_version: "1.13"
GO111MODULE: "off"
SODA_DIALECT: "sqlite"
steps:
Expand All @@ -45,17 +45,6 @@ jobs:
strategy:
matrix:
# Postgres
go 1.10 postgres:
go_version: "1.10"
SODA_DIALECT: "postgres"
go 1.11 (on) postgres:
go_version: "1.11.5"
GO111MODULE: "on"
SODA_DIALECT: "postgres"
go 1.11 (off) postgres:
go_version: "1.11.5"
GO111MODULE: "off"
SODA_DIALECT: "postgres"
go 1.12 (on) postgres:
go_version: "1.12"
GO111MODULE: "on"
Expand All @@ -64,33 +53,41 @@ jobs:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "postgres"
go 1.13 (on) postgres:
go_version: "1.13"
GO111MODULE: "on"
SODA_DIALECT: "postgres"
go 1.13 (off) postgres:
go_version: "1.13"
GO111MODULE: "off"
SODA_DIALECT: "postgres"
# Cockroach
go 1.12 (on) cockroach:
go_version: "1.12"
go 1.13 (on) cockroach:
go_version: "1.13"
GO111MODULE: "on"
SODA_DIALECT: "cockroach"
go 1.12 (off) cockroach:
go_version: "1.12"
go 1.13 (off) cockroach:
go_version: "1.13"
GO111MODULE: "off"
SODA_DIALECT: "cockroach"
# MySQL
go 1.12 (on) mysql:
go_version: "1.12"
go 1.13 (on) mysql:
go_version: "1.13"
GO111MODULE: "on"
SODA_DIALECT: "mysql"
MYSQL_PORT: "3307"
go 1.12 (off) mysql:
go_version: "1.12"
go 1.13 (off) mysql:
go_version: "1.13"
GO111MODULE: "off"
SODA_DIALECT: "mysql"
MYSQL_PORT: "3307"
# SQLite3
go 1.12 (on) sqlite:
go_version: "1.12"
go 1.13 (on) sqlite:
go_version: "1.13"
GO111MODULE: "on"
SODA_DIALECT: "sqlite"
go 1.12 (off) sqlite:
go_version: "1.12"
go 1.13 (off) sqlite:
go_version: "1.13"
GO111MODULE: "off"
SODA_DIALECT: "sqlite"
steps:
Expand Down
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ module github.com/gobuffalo/fizz
go 1.12

require (
github.com/blang/semver v3.5.1+incompatible
github.com/Masterminds/semver/v3 v3.0.3
github.com/go-sql-driver/mysql v1.4.1
github.com/gobuffalo/envy v1.7.1 // indirect
github.com/gobuffalo/helpers v0.2.4 // indirect
github.com/gobuffalo/packr/v2 v2.5.3
github.com/gobuffalo/plush v3.8.3+incompatible
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/onsi/ginkgo v1.9.0 // indirect
github.com/onsi/gomega v1.6.0 // indirect
github.com/rogpeppe/go-internal v1.4.0 // indirect
github.com/stretchr/testify v1.4.0
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
google.golang.org/appengine v1.6.1 // indirect
)
19 changes: 15 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Masterminds/semver/v3 v3.0.3 h1:znjIyLfpXEDQjOIEWh+ehwpTU14UzUPub3c3sm36u14=
github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
Expand All @@ -18,6 +18,8 @@ github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG
github.com/gobuffalo/attrs v0.1.0/go.mod h1:fmNpaWyHM0tRm8gCZWKx8yY9fvaNLo2PyzBNSrBZ5Hw=
github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
github.com/gobuffalo/envy v1.7.1 h1:OQl5ys5MBea7OGCdvPbBJWRgnhC/fGona6QKfvFeau8=
github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w=
github.com/gobuffalo/flect v0.1.5 h1:xpKq9ap8MbYfhuPCF0dBH854Gp9CxZjr/IocxELFflo=
github.com/gobuffalo/flect v0.1.5/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80=
github.com/gobuffalo/genny v0.2.0/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk=
Expand All @@ -40,8 +42,6 @@ github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4
github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
github.com/gobuffalo/packr/v2 v2.4.0/go.mod h1:ra341gygw9/61nSjAbfwcwh8IrYL4WmR4IsPkPBhQiY=
github.com/gobuffalo/packr/v2 v2.5.2/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08=
github.com/gobuffalo/packr/v2 v2.5.3 h1:egbOzIWXdPnB0iPMQ5LKxPN/bXnZXQJOXfD8zB/l1Ko=
github.com/gobuffalo/packr/v2 v2.5.3/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08=
github.com/gobuffalo/plush v3.8.2+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI=
github.com/gobuffalo/plush v3.8.3+incompatible h1:kzvUTnFPhwyfPEsx7U7LI05/IIslZVGnAlMA1heWub8=
github.com/gobuffalo/plush v3.8.3+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI=
Expand All @@ -61,6 +61,7 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
Expand Down Expand Up @@ -101,6 +102,9 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.4.0 h1:LUa41nrWTQNGhzdsZ5lTnkwbNjj6rXTdazA1cSdjkOY=
github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 h1:ofR1ZdrNSkiWcMsRrubK9tb2/SlZVWttAfqUjJi6QYc=
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
Expand All @@ -114,8 +118,10 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -141,9 +147,13 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -161,6 +171,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190613204242-ed0dc450797f/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1ji0lIGzm3KP8Y9VkS9PTE=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
Expand Down
30 changes: 0 additions & 30 deletions packrd/packed-packr.go

This file was deleted.

2 changes: 1 addition & 1 deletion translators/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (p *MySQL) RenameIndex(t fizz.Table) (string, error) {
if err != nil {
return "", err
}
if version.LT(mysql57Version) {
if version.LessThan(mysql57Version) {
return "", fmt.Errorf("renaming indexes on MySQL versions less than 5.7 is not supported by fizz; use raw SQL instead")
}
ix := t.Indexes
Expand Down
17 changes: 10 additions & 7 deletions translators/mysql_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/blang/semver"
"github.com/Masterminds/semver/v3"
"github.com/gobuffalo/fizz"
)

Expand Down Expand Up @@ -42,26 +42,29 @@ type mysqlSchema struct {
}

func (p *mysqlSchema) Version() (*semver.Version, error) {
var version *semver.Version
var err error

db, err := sql.Open("mysql", p.URL)
if err != nil {
return version, err
return nil, err
}
defer db.Close()

res, err := db.Query("SELECT VERSION()")
if err != nil {
return version, err
return nil, err
}
defer res.Close()

var rawVersion string
for res.Next() {
err = res.Scan(&version)
return version, err
err = res.Scan(&rawVersion)
if err != nil {
return nil, err
}
return semver.NewVersion(rawVersion)
}
return version, fmt.Errorf("could not fetch MySQL version")
return nil, fmt.Errorf("could not fetch MySQL version")
}

func (p *mysqlSchema) Build() error {
Expand Down

0 comments on commit beab577

Please sign in to comment.