Repository: SkygearIO/skygear-server
Pull request #935 (2019-05-30 04:24:11)

Go mod


Patch:
diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 00000000..653eeca1
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,16 @@
+linters:
+  disable-all: true
+  enable:
+  - deadcode
+  - gocyclo
+  - gofmt
+  - golint
+  - gosec
+  - govet
+  - ineffassign
+  - misspell
+  - staticcheck
+
+linters-settings:
+  gofmt:
+    simplify: false
diff --git a/.gometalinter.json b/.gometalinter.json
deleted file mode 100644
index f62f1943..00000000
--- a/.gometalinter.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-  "Enable": [
-    "deadcode",
-    "goconst",
-    "gocyclo",
-    "golint",
-    "gosec",
-    "ineffassign",
-    "misspell",
-    "vet",
-    "vetshadow",
-    "gofmt-"
-  ],
-  "Linters": {
-    "gofmt-": {
-      "Command": "gofmt -l",
-      "Pattern": "^(?P<path>.*?.go)$",
-      "IsFast": true,
-      "PartitionStrategy": "directories"
-    }
-  },
-  "Exclude": [
-    "declaration of \"err\"",
-    "warning: Errors unhandled",
-    "should have comment or be unexported",
-    "method ToSql should be ToSQL",
-    "composite literal uses unkeyed fields",
-    "_gen\\.go"
-  ],
-  "Skip": [
-    "pkg/server/skydb/mock_skydb",
-    "pkg/server/skydb/pq/migration",
-    "vendor"
-  ],
-  "Cyclo": 13
-}
diff --git a/.tool-versions b/.tool-versions
new file mode 100644
index 00000000..b15803a5
--- /dev/null
+++ b/.tool-versions
@@ -0,0 +1,1 @@
+golang 1.12.5
diff --git a/.travis.yml b/.travis.yml
index cf0063b2..654b2aad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,7 @@
 language: go
 
 go:
-  - 1.9.4
-  - 1.10.2
-  - 1.11
+  - 1.12.5
 
 addons:
   postgresql: "9.5"
@@ -14,7 +12,8 @@ services:
 
 cache:
   directories:
-    - $HOME/.cache
+    - $HOME/.cache/go-build
+    - $GOPATH/pkg/mod
 
 go_import_path: github.com/skygeario/skygear-server
 
@@ -27,16 +26,11 @@ before_install:
   - mkdir -p $LD_INSTALL_PREFIX/src
   - pushd $LD_INSTALL_PREFIX/src
   - popd
-  - sudo curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64
-  - sudo curl -fsSL -o /usr/local/bin/vg https://github.com/GetStream/vg/releases/download/v0.8.0/vg-linux-amd64
-  - curl -fsSL https://github.com/alecthomas/gometalinter/releases/download/v2.0.11/gometalinter-2.0.11-linux-amd64.tar.gz | sudo tar --strip-components 1 -C /usr/local/bin -zx
-  - sudo chmod +x /usr/local/bin/dep /usr/local/bin/vg
-  - 'eval "$(vg eval --shell bash)"'
-  - vg init
 
 install:
   - sudo apt-get install -y postgresql-9.5-postgis-2.3
-  - vg ensure
+  - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.16.0
+  - make vendor
 
 before_script:
   - psql -c 'CREATE DATABASE skygear_test;' -U postgres
@@ -86,5 +80,6 @@ notifications:
 
 env:
   global:
+    - GO111MODULE=on
     # GITHUB_RELEASE_TOKEN
     - secure: "ZYxuSD05SgXD3oyzmOOw+o0QpQeG76yoOknP/bSh2uqGgf27qHy+gxvUqBXuJIKVZiKSlfSEO07XMGI5Jl9SqfqumFVdyh5jI2pKN+pZ5yuDokiJagb57jrM/CRaJj0df7qrBa21PGxXDQ52htv1GKGHSDifaXoOdAk9Uetp734RFBWsHXDNSN/RISuedVE5v5d05tB+CqqTAc3pjteDZhfFU5Z89yWaUtMBaGEW8++1Wd2kkMdrPm18dZ4Ylta/VVlxyDY8vtVJUOpXyeLTNAEMB/YsqP3Uauc46ynxbfqZLty4H+3pP24jgBuEQuxCeTcc8HDfi+5twVJtZ/1Xp+7GrD/6CjPnaLqafW6lDD06n62HOgI2/fxWWCKvQslKmpmxUQDDWtsQzS/YzncoN+RekHx1FZ8Nl+NRB5lSuUTtc96dUQD/lC5bl1mjMZS28G6yTtUodDnRBprjyI5vCzqQjE+gutzuMPGgom3NGqRRfNIXPmhyvhBpLbNdrxALSYf8F27PZ8dWxBUk95w/1HnfeEkTGZyWE1MkpKi9lKtsLHd4KTbqu6jRoVfPayJyj3FlddK6Lb0GM3OXuw9yb2kO60ZEvs4jLRzGAURnFVZCgUZgR+SfEB1Txn+X/0T1iFEzUKr3UpuU/c4onJLAf/xhkOsRr9BtsC5KE7pGz0M="
diff --git a/Dockerfile.make b/Dockerfile.make
index 5e18b259..e558b13a 100644
--- a/Dockerfile.make
+++ b/Dockerfile.make
@@ -1,28 +1,21 @@
-FROM golang:1.10.4-stretch
+FROM golang:1.12.5-stretch
 
-WORKDIR /go/src/github.com/skygeario/skygear-server
+ENV GO111MODULE on
 SHELL ["/bin/bash", "-c"]
-RUN go get github.com/golang/dep/cmd/dep
 
-COPY Gopkg.toml Gopkg.lock ./
-RUN dep ensure --vendor-only
+WORKDIR /go/src/github.com/skygeario/skygear-server
+
+RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.16.0
+
+COPY go.mod go.sum ./
+RUN go mod download
 
-ENV GOBIN /go/bin
 COPY ./tools/nextimportslint.go ./tools/nextimportslint.go
 
-RUN \
-    cp -rf vendor/* /go/src; \
-    cd /go/src; \
-    for pkg in \
-        "golang.org/x/tools/cmd/stringer" \
-        "golang.org/x/tools/cmd/cover" \
-        "github.com/tinylib/msgp" \
-        "github.com/mitchellh/gox" \
-        "github.com/golang/mock/mockgen" \
-        ; do \
-        pushd $pkg; \
-        go install .; \
-        popd > /dev/null; \
-    done; \
-    go install ./github.com/skygeario/skygear-server/tools/nextimportslint.go; \
-    curl -fsSL https://github.com/alecthomas/gometalinter/releases/download/v2.0.11/gometalinter-2.0.11-linux-amd64.tar.gz | tar --strip-components 1 -C /usr/local/bin -zx;
+RUN go mod download
+RUN go install golang.org/x/tools/cmd/stringer
+RUN go install golang.org/x/tools/cmd/cover
+RUN go install github.com/tinylib/msgp
+RUN go install github.com/mitchellh/gox
+RUN go install github.com/golang/mock/mockgen
+RUN go install tools/nextimportslint.go
diff --git a/Gopkg.lock b/Gopkg.lock
deleted file mode 100644
index c42a6493..00000000
--- a/Gopkg.lock
+++ /dev/null
@@ -1,396 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
-  digest = "1:3e93e899f8457138a891b3ccedcacf8fe9074865c848f7028e1892bdae280676"
-  name = "github.com/dgrijalva/jwt-go"
-  packages = ["."]
-  pruneopts = ""
-  revision = "dbeaa9332f19a944acb5736b4456cfcc02140e29"
-  version = "v3.1.0"
-
-[[projects]]
-  digest = "1:d6b2b11e438ac3192f87dd1117ac16ee7ea57a43075a8e8b7dea5525d22bd001"
-  name = "github.com/evalphobia/logrus_fluent"
-  packages = ["."]
-  pruneopts = ""
-  revision = "76779e73f35d90f5a873e7feaf6691999b2c5db4"
-  version = "v0.4.0"
-
-[[projects]]
-  digest = "1:9fdd67ccb34e94602b72547c9943981458e76ba8eb6e43a5876a48dc7af1e5cb"
-  name = "github.com/flosch/pongo2"
-  packages = ["."]
-  pruneopts = ""
-  revision = "5e81b817a0c48c1c57cdf1a9056cf76bdee02ca9"
-  version = "v3.0"
-
-[[projects]]
-  digest = "1:3ad34cc6c4c4e20a1baa51379b0161b57f91864b5b9c7885734bcd8c8ba12c56"
-  name = "github.com/fluent/fluent-logger-golang"
-  packages = ["fluent"]
-  pruneopts = ""
-  revision = "8bbc2356beaf021b04c9bd5cdc76ea5a7ccb40ec"
-  version = "v1.3.0"
-
-[[projects]]
-  digest = "1:d10889ce4a5e570532e5b1f313e1a3ce4460d459ce90c7ccae3bfc89bd5718eb"
-  name = "github.com/franela/goreq"
-  packages = ["."]
-  pruneopts = ""
-  revision = "b5b0f5eb2d16f20345cce0a544a75163579c0b00"
-
-[[projects]]
-  digest = "1:cba75ccf02d7b1d508f860e1f579a986e6b94ccc26841d6dd67d18cd1196e132"
-  name = "github.com/go-gomail/gomail"
-  packages = ["."]
-  pruneopts = ""
-  revision = "41f3572897373c5538c50a2402db15db079fa4fd"
-  version = "2.0.0"
-
-[[projects]]
-  digest = "1:a53effe959542818285d7adee00ee2807babee2ea8b82956fe4a4cab60c34bd5"
-  name = "github.com/golang-migrate/migrate"
-  packages = [
-    ".",
-    "database",
-    "source",
-    "source/file",
-  ]
-  pruneopts = ""
-  revision = "22f249514de9aa3f8a720a7cabbdd45d294f83a1"
-  version = "v3.2.0"
-
-[[projects]]
-  digest = "1:73a7106c799f98af4f3da7552906efc6a2570329f4cd2d2f5fb8f9d6c053ff2f"
-  name = "github.com/golang/mock"
-  packages = [
-    "mockgen",
-    "mockgen/model",
-  ]
-  pruneopts = ""
-  revision = "c34cdb4725f4c3844d095133c6e40e448b86589b"
-  version = "v1.1.1"
-
-[[projects]]
-  branch = "master"
-  digest = "1:f1648d325872983461c860bc6641d8aaf8880f66856a5e0d9b39247556737d0d"
-  name = "github.com/gopherjs/gopherjs"
-  packages = ["js"]
-  pruneopts = ""
-  revision = "444abdf920945de5d4a977b572bcc6c674d1e4eb"
-
-[[projects]]
-  digest = "1:dbbeb8ddb0be949954c8157ee8439c2adfd8dc1c9510eb44a6e58cb68c3dce28"
-  name = "github.com/gorilla/context"
-  packages = ["."]
-  pruneopts = ""
-  revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42"
-  version = "v1.1.1"
-
-[[projects]]
-  digest = "1:c2c8666b4836c81a1d247bdf21c6a6fc1ab586538ab56f74437c2e0df5c375e1"
-  name = "github.com/gorilla/mux"
-  packages = ["."]
-  pruneopts = ""
-  revision = "e3702bed27f0d39777b0b37b664b6280e8ef8fbf"
-  version = "v1.6.2"
-
-[[projects]]
-  digest = "1:529dd39ce1a3837709c5f1dbf0a803ecb22e4fef79c722cdd9805e2a63ca686e"
-  name = "github.com/gorilla/schema"
-  packages = ["."]
-  pruneopts = ""
-  revision = "d0e4c24cff97ae983e9847e0ed5a02dc10013d41"
-  version = "v1.0.2"
-
-[[projects]]
-  digest = "1:6a8a36d8b25b669d77ff638f7acdf4d3439ce6c349461f246b2c450b0b4b3bc8"
-  name = "github.com/h2non/gock"
-  packages = ["."]
-  pruneopts = ""
-  revision = "a6029d17e101ac1594adafea9e63fd8c988a8701"
-  version = "v1.0.12"
-
-[[projects]]
-  digest = "1:57fcf9db7cd7b5c885504e9f085c5b6d6bf5320f4dc6c74d0fce88b7f472a6eb"
-  name = "github.com/jmoiron/sqlx"
-  packages = [
-    ".",
-    "reflectx",
-  ]
-  pruneopts = ""
-  revision = "d9bd385d68c068f1fabb5057e3dedcbcbb039d0f"
-
-[[projects]]
-  digest = "1:aa8336a0adb2292a64f609b321141930dbf01c0161618e6e7ba8a232b591fe3a"
-  name = "github.com/joho/godotenv"
-  packages = ["."]
-  pruneopts = ""
-  revision = "4ed13390c0acd2ff4e371e64d8b97c8954138243"
-
-[[projects]]
-  digest = "1:d8ead22d381cfed54d53be7d935eb0f9f2b75889a4fb595802844b805dc13b87"
-  name = "github.com/jtolds/gls"
-  packages = ["."]
-  pruneopts = ""
-  revision = "77f18212c9c7edc9bd6a33d383a7b545ce62f064"
-  version = "v4.2.1"
-
-[[projects]]
-  digest = "1:b60a24f942c7031ece6c48bcab0b683c7d3d6aa9fd17e21459d9ae604da258fa"
-  name = "github.com/kelseyhightower/envconfig"
-  packages = ["."]
-  pruneopts = ""
-  revision = "f611eb38b3875cc3bd991ca91c51d06446afa14c"
-  version = "v1.3.0"
-
-[[projects]]
-  branch = "master"
-  digest = "1:109e0a9b9e74c5c8adf94a2dc4dd4a9ca2a183d4d87ffecd4e62db69a5ede55a"
-  name = "github.com/kr/text"
-  packages = ["."]
-  pruneopts = ""
-  revision = "7cafcd837844e784b526369c9bce262804aebc60"
-
-[[projects]]
-  branch = "master"
-  digest = "1:7b1b752700b4889f6184e871b1fe02e6acbd69e21282d95143c9e1c90f71436d"
-  name = "github.com/lann/builder"
-  packages = ["."]
-  pruneopts = ""
-  revision = "f22ce00fd9394014049dad11c244859432bd6820"
-
-[[projects]]
-  branch = "master"
-  digest = "1:bfb195bbfe4edff0d8a078dd59d7567aae6f3c0d1a2cdf855fdcdd23c9b3bd8d"
-  name = "github.com/lann/ps"
-  packages = ["."]
-  pruneopts = ""
-  revision = "62de8c46ede02a7675c4c79c84883eb164cb71e3"
-
-[[projects]]
-  digest = "1:c302d5b4ac245049dc5d5b7a6888ccc59253be3e5c271587c4e200a295f618a4"
-  name = "github.com/lann/squirrel"
-  packages = ["."]
-  pruneopts = ""
-  revision = "e13dbacee404686afd0acf2d44b8d34869605e03"
-
-[[projects]]
-  digest = "1:c427c0ff484d0eda383188ee5559a1b28783a579e2a64b8dc4e3a15d38ee3cc2"
-  name = "github.com/lib/pq"
-  packages = [
-    ".",
-    "oid",
-  ]
-  pruneopts = ""
-  revision = "8c6ee72f3e6bcb1542298dd5f76cb74af9742cec"
-
-[[projects]]
-  digest = "1:65a4ff6c72881f9ff4e42eb348feb24fb01b10409b30aef36d27cc95130d58df"
-  name = "github.com/mitchellh/gox"
-  packages = ["."]
-  pruneopts = ""
-  revision = "54b619477e8932bbb6314644c867e7e6db7a9c71"
-  version = "v0.3.0"
-
-[[projects]]
-  branch = "master"
-  digest = "1:6b4b039f43644079036ee273cbdcda751528f162899bdb50dc1f17527a1f3e7c"
-  name = "github.com/mitchellh/iochan"
-  packages = ["."]
-  pruneopts = ""
-  revision = "87b45ffd0e9581375c491fef3d32130bb15c5bd7"
-
-[[projects]]
-  digest = "1:9da71b9d17d6231f1486dc62d81af3f9d34535703ba9e7a60a902433c3091e3b"
-  name = "github.com/nbutton23/zxcvbn-go"
-  packages = [
-    ".",
-    "adjacency",
-    "data",
-    "entropy",
-    "frequency",
-    "match",
-    "matching",
-    "scoring",
-    "utils/math",
-  ]
-  pruneopts = ""
-  revision = "eafdab6b0663b4b528c35975c8b0e78be6e25261"
-
-[[projects]]
-  digest = "1:f722fdc18c97d7ab558b3600d67a29613d5a177b562b6550a01210ea1f228181"
-  name = "github.com/njern/gonexmo"
-  packages = ["."]
-  pruneopts = ""
-  revision = "decd62febd9bd8900d1e5b896dd8573ec9cff48d"
-  version = "v2.0.0"
-
-[[projects]]
-  digest = "1:210286d0cb60ffe28f1ca00b664029e8943009f95d06d8f8c336301b28e1aee5"
-  name = "github.com/philhofer/fwd"
-  packages = ["."]
-  pruneopts = ""
-  revision = "bb6d471dc95d4fe11e432687f8b70ff496cf3136"
-  version = "v1.0.0"
-
-[[projects]]
-  digest = "1:4ac2fb46d321a3755a3bb012f5654580c1d564d954fb130d1c5f139973d8eefe"
-  name = "github.com/rifflock/lfshook"
-  packages = ["."]
-  pruneopts = ""
-  revision = "1fdc019a35147ddbb3d25aedf713ad6d1430c144"
-  version = "v2.2"
-
-[[projects]]
-  branch = "master"
-  digest = "1:2ac1e872ebd6b3904dfde61cbeaea124b3e3d51393966819a104a84642a5b325"
-  name = "github.com/sfreiberg/gotwilio"
-  packages = ["."]
-  pruneopts = ""
-  revision = "a13e5b0d458a0a7d43d24d118af756822d02d26c"
-
-[[projects]]
-  digest = "1:3ac248add5bb40a3c631c5334adcd09aa72d15af2768a5bc0274084ea7b2e5ba"
-  name = "github.com/sirupsen/logrus"
-  packages = [
-    ".",
-    "hooks/test",
-  ]
-  pruneopts = ""
-  revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e"
-  version = "v1.0.3"
-
-[[projects]]
-  digest = "1:fbf54e9f8cf26ea8e66dc1e0cc615663efa95af8c8d806125ff7f7bb7311b9e0"
-  name = "github.com/smartystreets/assertions"
-  packages = [
-    ".",
-    "internal/go-render/render",
-    "internal/oglematchers",
-  ]
-  pruneopts = ""
-  revision = "ff1918e1e5a13a74014644ae7c1e0ba2f791364d"
-  version = "1.8.0"
-
-[[projects]]
-  digest = "1:dd808f0f1628ff85a1b54424d3e6a61c54a87353d5063b9b5c82ad360f0346d5"
-  name = "github.com/smartystreets/goconvey"
-  packages = [
-    "convey",
-    "convey/gotest",
-    "convey/reporting",
-  ]
-  pruneopts = ""
-  revision = "9e8dc3f972df6c8fcc0375ef492c24d0bb204857"
-  version = "1.6.3"
-
-[[projects]]
-  digest = "1:cae65c1f3471b1f456a9d8a160440f4824ad50c718a15da4144490fbc3b12e49"
-  name = "github.com/tinylib/msgp"
-  packages = [
-    ".",
-    "gen",
-    "msgp",
-    "parse",
-    "printer",
-  ]
-  pruneopts = ""
-  revision = "b2b6a672cf1e5b90748f79b8b81fc8c5cf0571a1"
-  version = "1.0.2"
-
-[[projects]]
-  digest = "1:ccbb809cca94fd697821dced4515c88a1ed45f3d063b3f921b134b63d4311dc2"
-  name = "github.com/ttacon/chalk"
-  packages = ["."]
-  pruneopts = ""
-  revision = "76b3c8b611dea8f83e49e9ce81fc2b189e0ef3d2"
-  version = "v0.1"
-
-[[projects]]
-  digest = "1:8aca1243481ad054210f5b997c70656ce32ece00b0cfdebc816ed515c81e76ea"
-  name = "github.com/twinj/uuid"
-  packages = ["."]
-  pruneopts = ""
-  revision = "b505f2cca343b7b21416b27b1f2ad88469800892"
-
-[[projects]]
-  digest = "1:f1572790f40db82f8b23ee5569971bad1d4ea2b7b69bc54216371a467ff62f07"
-  name = "golang.org/x/crypto"
-  packages = [
-    "bcrypt",
-    "blowfish",
-    "ssh/terminal",
-  ]
-  pruneopts = ""
-  revision = "173ce04bfaf66c7bb0fa9d5c0bfd93e773909dbd"
-
-[[projects]]
-  branch = "master"
-  digest = "1:9c286cf11d0ca56368185bada5dd6d97b6be4648fc26c354fcba8df7293718f7"
-  name = "golang.org/x/sys"
-  packages = ["unix"]
-  pruneopts = ""
-  revision = "bf42f188b9bc6f2cf5b8ee5a912ef1aedd0eba4c"
-
-[[projects]]
-  branch = "master"
-  digest = "1:3fb1e52d981ace7965dcaf3e32a61a7a3e56ded1ec21a1a71f13448078010861"
-  name = "golang.org/x/tools"
-  packages = [
-    "cmd/cover",
-    "cmd/stringer",
-    "cover",
-    "go/ast/astutil",
-    "imports",
-  ]
-  pruneopts = ""
-  revision = "6d70fb2e85323e81c89374331d3d2b93304faa36"
-
-[[projects]]
-  branch = "v3"
-  digest = "1:fa33d1dde8ce5b0b37c38c767c250a7684ecd385f9dbabe594ea8543e4d55807"
-  name = "gopkg.in/alexcesaro/quotedprintable.v3"
-  packages = ["."]
-  pruneopts = ""
-  revision = "2caba252f4dc53eaf6b553000885530023f54623"
-
-[solve-meta]
-  analyzer-name = "dep"
-  analyzer-version = 1
-  input-imports = [
-    "github.com/dgrijalva/jwt-go",
-    "github.com/evalphobia/logrus_fluent",
-    "github.com/flosch/pongo2",
-    "github.com/franela/goreq",
-    "github.com/go-gomail/gomail",
-    "github.com/golang-migrate/migrate",
-    "github.com/golang-migrate/migrate/database",
-    "github.com/golang-migrate/migrate/source/file",
-    "github.com/golang/mock/mockgen",
-    "github.com/gorilla/mux",
-    "github.com/h2non/gock",
-    "github.com/jmoiron/sqlx",
-    "github.com/joho/godotenv",
-    "github.com/kelseyhightower/envconfig",
-    "github.com/kr/text",
-    "github.com/lann/squirrel",
-    "github.com/lib/pq",
-    "github.com/mitchellh/gox",
-    "github.com/nbutton23/zxcvbn-go",
-    "github.com/njern/gonexmo",
-    "github.com/rifflock/lfshook",
-    "github.com/sfreiberg/gotwilio",
-    "github.com/sirupsen/logrus",
-    "github.com/sirupsen/logrus/hooks/test",
-    "github.com/smartystreets/goconvey/convey",
-    "github.com/tinylib/msgp",
-    "github.com/tinylib/msgp/msgp",
-    "github.com/twinj/uuid",
-    "golang.org/x/crypto/bcrypt",
-    "golang.org/x/tools/cmd/cover",
-    "golang.org/x/tools/cmd/stringer",
-  ]
-  solver-name = "gps-cdcl"
-  solver-version = 1
diff --git a/Gopkg.toml b/Gopkg.toml
deleted file mode 100644
index f9c1ea66..00000000
--- a/Gopkg.toml
+++ /dev/null
@@ -1,117 +0,0 @@
-
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-#   name = "github.com/user/project"
-#   version = "1.0.0"
-#
-# [[constraint]]
-#   name = "github.com/user/project2"
-#   branch = "dev"
-#   source = "github.com/myfork/project2"
-#
-# [[override]]
-#  name = "github.com/x/y"
-#  version = "2.4.0"
-
-required = [
-  "golang.org/x/tools/cmd/stringer",
-  "golang.org/x/tools/cmd/cover",
-  "github.com/mitchellh/gox",
-  "github.com/golang/mock/mockgen",
-  "github.com/tinylib/msgp"
-]
-
-[[constraint]]
-  name = "github.com/dgrijalva/jwt-go"
-  version = "~3.1.0"
-
-[[constraint]]
-  name = "github.com/evalphobia/logrus_fluent"
-  version = "0.4.0"
-
-[[constraint]]
-  name = "github.com/franela/goreq"
-  revision = "b5b0f5eb2d16f20345cce0a544a75163579c0b00"
-
-[[constraint]]
-  name = "github.com/golang/mock"
-  version = "~1.1.0"
-
-[[constraint]]
-  name = "github.com/jmoiron/sqlx"
-  revision = "d9bd385d68c068f1fabb5057e3dedcbcbb039d0f"
-
-[[constraint]]
-  name = "github.com/joho/godotenv"
-  revision = "4ed13390c0acd2ff4e371e64d8b97c8954138243"
-
-[[constraint]]
-  name = "github.com/lann/squirrel"
-  revision = "e13dbacee404686afd0acf2d44b8d34869605e03"
-
-[[constraint]]
-  name = "github.com/lib/pq"
-  revision = "8c6ee72f3e6bcb1542298dd5f76cb74af9742cec"
-
-[[constraint]]
-  name = "github.com/sirupsen/logrus"
-  version = "1.0.1"
-
-[[constraint]]
-  name = "github.com/smartystreets/goconvey"
-  version = "~1.6.3"
-
-[[constraint]]
-  name = "github.com/twinj/uuid"
-  revision = "b505f2cca343b7b21416b27b1f2ad88469800892"
-
-[[constraint]]
-  name = "golang.org/x/crypto"
-  revision = "173ce04bfaf66c7bb0fa9d5c0bfd93e773909dbd"
-
-[[constraint]]
-  name = "github.com/nbutton23/zxcvbn-go"
-  revision = "eafdab6b0663b4b528c35975c8b0e78be6e25261"
-
-[[constraint]]
-  name = "github.com/rifflock/lfshook"
-  version = "2.2.0"
-
-[[constraint]]
-  branch = "master"
-  name = "github.com/kr/text"
-
-[[constraint]]
-  name = "github.com/kelseyhightower/envconfig"
-  version = "1.3.0"
-
-[[constraint]]
-  name = "github.com/tinylib/msgp"
-  version = "1.0.2"
-
-[[constraint]]
-  name = "github.com/go-gomail/gomail"
-  version = "2.0.0"
-
-[[constraint]]
-  name = "github.com/flosch/pongo2"
-  version = "3.0.0"
-
-[[constraint]]
-  branch = "master"
-  name = "github.com/sfreiberg/gotwilio"
-
-[[constraint]]
-  name = "github.com/njern/gonexmo"
-  version = "2.0.0"
-
-[[constraint]]
-  name = "github.com/h2non/gock"
-  version = "1.0.12"
diff --git a/Makefile b/Makefile
index efe6f161..c1591b8a 100644
--- a/Makefile
+++ b/Makefile
@@ -42,27 +42,24 @@ GO_TEST_ARGS := $(GO_BUILD_ARGS) -cover -timeout $(GO_TEST_TIMEOUT) $(GO_TEST_AR
 
 .PHONY: vendor
 vendor:
-	$(DOCKER_RUN) dep ensure
-
-.PHONY: go-install
-go-install:
-	$(DOCKER_RUN) go install $(GO_BUILD_ARGS) ./...
-	$(DOCKER_RUN) go install tools/nextimportslint.go
+	curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $$(go env GOPATH)/bin v1.16.0
+	go mod download
+	go install golang.org/x/tools/cmd/stringer
+	go install golang.org/x/tools/cmd/cover
+	go install github.com/tinylib/msgp
+	go install github.com/mitchellh/gox
+	go install github.com/golang/mock/mockgen
+	go install tools/nextimportslint.go
 
 .PHONY: go-generate
-go-generate: go-install
+go-generate:
 	$(DOCKER_RUN) find pkg -type f -name "*_gen.go" -delete
 	$(DOCKER_RUN) find pkg -type f -name "mockgen_*.go" -delete
 	$(DOCKER_RUN) go generate ./pkg/...
 
 .PHONY: go-lint
-go-lint: go-install
-	$(DOCKER_RUN) gometalinter --disable-all \
-		-enable=staticcheck --enable=golint --enable=misspell --enable=gocyclo \
-		--linter='gocyclo:gocyclo -over 15:^(?P<cyclo>\d+)\s+\S+\s(?P<function>\S+)\s+(?P<path>.*?\.go):(?P<line>\d+):(\d+)$'' \
-		./...
-# Next linter have stricter rule
-	$(DOCKER_RUN) gometalinter ./pkg/auth/... ./pkg/core/... ./pkg/gateway/...
+go-lint:
+	$(DOCKER_RUN) golangci-lint run ./cmd/... ./pkg/...
 	$(DOCKER_RUN) nextimportslint
 
 .PHONY: generate
@@ -76,7 +73,7 @@ build:
 .PHONY: test
 test:
 # Run `go install` to compile packages for caching and catch compilation error.
-	$(DOCKER_RUN) go install $(GO_BUILD_ARGS) ./...
+	$(DOCKER_RUN) go install $(GO_BUILD_ARGS) ./cmd/...
 	$(DOCKER_RUN) go test $(GO_TEST_ARGS) $(GO_TEST_PACKAGE)
 
 .PHONY: lint
diff --git a/cmd/auth/Dockerfile b/cmd/auth/Dockerfile
index 0203b29f..d1fc4728 100644
--- a/cmd/auth/Dockerfile
+++ b/cmd/auth/Dockerfile
@@ -1,10 +1,11 @@
-FROM golang:1.10.4-stretch as godev
+FROM golang:1.12.5-stretch as godev
+
+ENV GO111MODULE on
 
 WORKDIR /go/src/github.com/skygeario/skygear-server
-RUN go get github.com/golang/dep/cmd/dep
 
-COPY Gopkg.toml Gopkg.lock ./
-RUN dep ensure --vendor-only
+COPY go.mod go.sum ./
+RUN go mod download
 
 COPY . .
 RUN cd cmd/auth; make build; mv skygear-auth /tmp/
diff --git a/cmd/gateway/Dockerfile b/cmd/gateway/Dockerfile
index 3185a9ab..06c1e22c 100644
--- a/cmd/gateway/Dockerfile
+++ b/cmd/gateway/Dockerfile
@@ -1,10 +1,11 @@
-FROM golang:1.10.4-stretch as godev
+FROM golang:1.12.5-stretch as godev
+
+ENV GO111MODULE on
 
 WORKDIR /go/src/github.com/skygeario/skygear-server
-RUN go get github.com/golang/dep/cmd/dep
 
-COPY Gopkg.toml Gopkg.lock ./
-RUN dep ensure --vendor-only
+COPY go.mod go.sum ./
+RUN go mod download
 
 COPY . .
 RUN cd cmd/gateway; make build; mv skygear-gateway /tmp/
diff --git a/cmd/migrate/Dockerfile b/cmd/migrate/Dockerfile
index 5eef5566..7bbc5a97 100644
--- a/cmd/migrate/Dockerfile
+++ b/cmd/migrate/Dockerfile
@@ -1,10 +1,11 @@
-FROM golang:1.10.4-stretch as godev
+FROM golang:1.12.5-stretch as godev
+
+ENV GO111MODULE on
 
 WORKDIR /go/src/github.com/skygeario/skygear-server
-RUN go get github.com/golang/dep/cmd/dep
 
-COPY Gopkg.toml Gopkg.lock ./
-RUN dep ensure --vendor-only
+COPY go.mod go.sum ./
+RUN go mod download
 
 COPY . .
 RUN cd cmd/migrate; make build; mv skygear-migrate /tmp/
diff --git a/devtools/devtools.go b/devtools/devtools.go
new file mode 100644
index 00000000..9ea4967f
--- /dev/null
+++ b/devtools/devtools.go
@@ -0,0 +1,15 @@
+package devtools
+
+// The imports here are main packages.
+// So they are not importable.
+// We list them here so that `go mod`
+// know them and add them to go.mod
+// Because the imports are main packages,
+// this package itself cannot compile.
+import (
+	_ "github.com/golang/mock/mockgen"
+	_ "github.com/mitchellh/gox"
+	_ "github.com/tinylib/msgp"
+	_ "golang.org/x/tools/cmd/cover"
+	_ "golang.org/x/tools/cmd/stringer"
+)
diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..21ff98df
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,58 @@
+module github.com/skygeario/skygear-server
+
+go 1.12
+
+require (
+	github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
+	github.com/dgrijalva/jwt-go v3.1.0+incompatible
+	github.com/evalphobia/logrus_fluent v0.4.0
+	github.com/flosch/pongo2 v0.0.0-20141028000813-5e81b817a0c4
+	github.com/fluent/fluent-logger-golang v1.3.0 // indirect
+	github.com/franela/goblin v0.0.0-20181003173013-ead4ad1d2727 // indirect
+	github.com/franela/goreq v0.0.0-20170418064916-b5b0f5eb2d16
+	github.com/go-gomail/gomail v0.0.0-20150902115704-41f357289737
+	github.com/go-sql-driver/mysql v1.4.1 // indirect
+	github.com/golang-migrate/migrate v3.2.0+incompatible
+	github.com/golang/mock v1.3.1
+	github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c // indirect
+	github.com/gorilla/context v1.1.1 // indirect
+	github.com/gorilla/mux v1.6.2
+	github.com/gorilla/schema v1.0.2 // indirect
+	github.com/h2non/gock v1.0.12
+	github.com/jmoiron/sqlx v0.0.0-20170430194603-d9bd385d68c0
+	github.com/joho/godotenv v0.0.0-20150907010228-4ed13390c0ac
+	github.com/kelseyhightower/envconfig v1.3.0
+	github.com/kr/pretty v0.1.0 // indirect
+	github.com/kr/text v0.1.0
+	github.com/lann/builder v0.0.0-20150808151131-f22ce00fd939 // indirect
+	github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
+	github.com/lann/squirrel v0.0.0-20150302165045-e13dbacee404
+	github.com/lib/pq v0.0.0-20171113044440-8c6ee72f3e6b
+	github.com/mattn/go-sqlite3 v1.10.0 // indirect
+	github.com/mitchellh/gox v1.0.1
+	github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 // indirect
+	github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663
+	github.com/njern/gonexmo v2.0.0+incompatible
+	github.com/onsi/gomega v1.5.0 // indirect
+	github.com/philhofer/fwd v1.0.0 // indirect
+	github.com/rifflock/lfshook v0.0.0-20171219153109-1fdc019a3514
+	github.com/sfreiberg/gotwilio v0.0.0-20181012193634-a13e5b0d458a
+	github.com/sirupsen/logrus v1.0.3
+	github.com/smartystreets/assertions v1.0.0 // indirect
+	github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a
+	github.com/stretchr/testify v1.3.0 // indirect
+	github.com/tinylib/msgp v1.0.2
+	github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31 // indirect
+	github.com/twinj/uuid v0.0.0-20160621131530-b505f2cca343
+	golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5
+	golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect
+	golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed // indirect
+	golang.org/x/text v0.3.2 // indirect
+	golang.org/x/tools v0.0.0-20190602112858-2de7f9bf822c
+	google.golang.org/appengine v1.6.0 // indirect
+	gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
+	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
+	gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
+	gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
+	gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 00000000..5a35570c
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,155 @@
+github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
+github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgrijalva/jwt-go v3.1.0+incompatible h1:FFziAwDQQ2dz1XClWMkwvukur3evtZx7x/wMHKM1i20=
+github.com/dgrijalva/jwt-go v3.1.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
+github.com/evalphobia/logrus_fluent v0.4.0 h1:uYIgSLezcopy6V7Epr5yIvsnzGqH+bE/62b32xIEe+A=
+github.com/evalphobia/logrus_fluent v0.4.0/go.mod h1:hasyj+CXm3BDP1YhFk/rnTcjlegyqvkokV9A25cQsaA=
+github.com/flosch/pongo2 v0.0.0-20141028000813-5e81b817a0c4 h1:TKrPydYuxU20WC6/sOVc1HZ4bfgkL1CAiZm6l9wbzBY=
+github.com/flosch/pongo2 v0.0.0-20141028000813-5e81b817a0c4/go.mod h1:rE0ErqqBaMcp9pzj8JxV1GcfDBpuypXYxlR1c37AUwg=
+github.com/fluent/fluent-logger-golang v1.3.0 h1:oBolFKS9fY9HReChzaX1RQF5GkdNdByrledPTfUWoGA=
+github.com/fluent/fluent-logger-golang v1.3.0/go.mod h1:2/HCT/jTy78yGyeNGQLGQsjF3zzzAuy6Xlk6FCMV5eU=
+github.com/franela/goblin v0.0.0-20181003173013-ead4ad1d2727 h1:eouy4stZdUKn7n98c1+rdUTxWMg+jvhP+oHt0K8fiug=
+github.com/franela/goblin v0.0.0-20181003173013-ead4ad1d2727/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
+github.com/franela/goreq v0.0.0-20170418064916-b5b0f5eb2d16 h1:oBUKHp5f9Q+41u85FETNuJJvJUGhBS/b2zL7OB9bBmY=
+github.com/franela/goreq v0.0.0-20170418064916-b5b0f5eb2d16/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
+github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/go-gomail/gomail v0.0.0-20150902115704-41f357289737 h1:AkOq33Mv/qyW/s31VOQsXU9yg8WG/dc0VZX320ij3vY=
+github.com/go-gomail/gomail v0.0.0-20150902115704-41f357289737/go.mod h1:GJr+FCSXshIwgHBtLglIg9M2l2kQSi6QjVAngtzI08Y=
+github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
+github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
+github.com/golang-migrate/migrate v3.2.0+incompatible h1:x1l6K+XV0WxOuHG/5gREA9rPX01tzS58RMEmCBei/To=
+github.com/golang-migrate/migrate v3.2.0+incompatible/go.mod h1:IsVUlFN5puWOmXrqjgGUfIRIbU7mr8oNBE2tyERd9Wk=
+github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
+github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
+github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4=
+github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
+github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
+github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk=
+github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/schema v1.0.2 h1:sAgNfOcNYvdDSrzGHVy9nzCQahG+qmsg+nE8dK85QRA=
+github.com/gorilla/schema v1.0.2/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
+github.com/h2non/gock v1.0.12 h1:e1lLoiLdVdzJoqqCRtm1tbqCEDWG9Xei/1mzmav+GAs=
+github.com/h2non/gock v1.0.12/go.mod h1:CZMcB0Lg5IWnr9bF79pPMg9WeV6WumxQiUJ1UvdO1iE=
+github.com/hashicorp/go-version v1.0.0 h1:21MVWPKDphxa7ineQQTrCU5brh7OuVVAzGOCnnCPtE8=
+github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/jmoiron/sqlx v0.0.0-20170430194603-d9bd385d68c0 h1:oZ1oQfWp4h9VX9Fmorc9DrmbHBwiw+mXphFDTVNp1vI=
+github.com/jmoiron/sqlx v0.0.0-20170430194603-d9bd385d68c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU=
+github.com/joho/godotenv v0.0.0-20150907010228-4ed13390c0ac h1:wF2VgtpbaLqhBHV9FxVWzgzgv8VcCjZ66Bl/+F6cpT0=
+github.com/joho/godotenv v0.0.0-20150907010228-4ed13390c0ac/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
+github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
+github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/kelseyhightower/envconfig v1.3.0 h1:IvRS4f2VcIQy6j4ORGIf9145T/AsUB+oY8LyvN8BXNM=
+github.com/kelseyhightower/envconfig v1.3.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/lann/builder v0.0.0-20150808151131-f22ce00fd939 h1:yZJImkCmVI6d1uJ9KRRf/96YbFLDQ/hhs6Xt9Z3OBXI=
+github.com/lann/builder v0.0.0-20150808151131-f22ce00fd939/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
+github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
+github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
+github.com/lann/squirrel v0.0.0-20150302165045-e13dbacee404 h1:6fsBLR4qBo+3Niitnn7ncBJZWGQTe2glCkbtkT91910=
+github.com/lann/squirrel v0.0.0-20150302165045-e13dbacee404/go.mod h1:TrtGxMTuq61q6xmzO7D/fwYtKGlu/awbp3AwqFEK6gY=
+github.com/lib/pq v0.0.0-20171113044440-8c6ee72f3e6b h1:ITqD/2RWsKgBmfLYE2/urbXT3crKmfkuqg8bewO0c/U=
+github.com/lib/pq v0.0.0-20171113044440-8c6ee72f3e6b/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
+github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI=
+github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4=
+github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
+github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
+github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
+github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
+github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663 h1:Ri1EhipkbhWsffPJ3IPlrb4SkTOPa2PfRXp3jchBczw=
+github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
+github.com/njern/gonexmo v2.0.0+incompatible h1:LSCDbbdttDqrAYvgIp9aVPwHsQkWg0sRSlaV6aAZGJk=
+github.com/njern/gonexmo v2.0.0+incompatible/go.mod h1:JCPIYf4DYSY4fxFKU79wPEH5H6i7Xzlxwae57fWiRT0=
+github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
+github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
+github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rifflock/lfshook v0.0.0-20171219153109-1fdc019a3514 h1:a0R0Z5Uy5ZwEUiJOz9wxfFf46Vy9VOQNGFR1v4ddiZ4=
+github.com/rifflock/lfshook v0.0.0-20171219153109-1fdc019a3514/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
+github.com/sfreiberg/gotwilio v0.0.0-20181012193634-a13e5b0d458a h1:xjXzhIL25PhgS+Bwpghr9biB1dHOXrnmdD3KiCpAASQ=
+github.com/sfreiberg/gotwilio v0.0.0-20181012193634-a13e5b0d458a/go.mod h1:60PiR0SAnAcYSiwrXB6BaxeqHdXMf172toCosHfV+Yk=
+github.com/sirupsen/logrus v1.0.3 h1:B5C/igNWoiULof20pKfY4VntcIPqKuwEmoLZrabbUrc=
+github.com/sirupsen/logrus v1.0.3/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
+github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8=
+github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
+github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
+github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/tinylib/msgp v1.0.2 h1:DfdQrzQa7Yh2es9SuLkixqxuXS2SxsdYn0KbdrOGWD8=
+github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
+github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31 h1:OXcKh35JaYsGMRzpvFkLv/MEyPuL49CThT1pZ8aSml4=
+github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
+github.com/twinj/uuid v0.0.0-20160621131530-b505f2cca343 h1:nq9qUOuI9ixukNlDFoWQQoJVmHqy310WiwvqUYBzhvc=
+github.com/twinj/uuid v0.0.0-20160621131530-b505f2cca343/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5 h1:8dUaAV7K4uHsF56JQWkprecIQKdPHtR9jCHF5nB8uzc=
+golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco=
+golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
+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/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed h1:uPxWBzB3+mlnjy9W58qY1j/cjyFjutgw/Vhan2zLy/A=
+golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190602112858-2de7f9bf822c h1:8QARbM77BTyoVvSaGaoQPCYgZlVROYX1uKApKK98b+8=
+golang.org/x/tools v0.0.0-20190602112858-2de7f9bf822c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+google.golang.org/appengine v1.6.0 h1:Tfd7cKwKbFRsI8RMAD3oqqw7JPFRrvFlOsfbgVkjOOw=
+google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo=
+gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
+gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
+gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 h1:OAj3g0cR6Dx/R07QgQe8wkA9RNjB2u4i700xBkIT4e0=
+gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
+gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
+gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/pkg/auth/dependency/provider/oauth/provider.go b/pkg/auth/dependency/provider/oauth/provider.go
index 5784fc67..93c4550f 100644
--- a/pkg/auth/dependency/provider/oauth/provider.go
+++ b/pkg/auth/dependency/provider/oauth/provider.go
@@ -192,6 +192,7 @@ func (p *providerImpl) UpdatePrincipal(principal *Principal) (err error) {
 	if err != nil {
 		if db.IsUniqueViolated(err) {
 			err = skydb.ErrUserDuplicated
+			return
 		}
 	}
 
diff --git a/pkg/auth/handler/sso/customtoken.go b/pkg/auth/handler/sso/customtoken.go
index ec29b9b0..5be13f55 100644
--- a/pkg/auth/handler/sso/customtoken.go
+++ b/pkg/auth/handler/sso/customtoken.go
@@ -252,6 +252,12 @@ func (h CustomTokenLoginHandler) handleLogin(payload customTokenLoginPayload, in
 		principal.TokenPrincipalID = payload.Claims.Subject
 		principal.UserID = info.ID
 		err = h.CustomTokenAuthProvider.CreatePrincipal(principal)
+		// TODO:
+		// return proper error
+		if err != nil {
+			err = skyerr.NewError(skyerr.UnexpectedError, "Unable to create principal")
+			return
+		}
 	} else {
 		if e := h.AuthInfoStore.GetAuth(principal.UserID, info); e != nil {
 			if err == skydb.ErrUserNotFound {
diff --git a/pkg/core/skyerr/errorcode_string.go b/pkg/core/skyerr/errorcode_string.go
index e82bd0b3..75c21891 100644
--- a/pkg/core/skyerr/errorcode_string.go
+++ b/pkg/core/skyerr/errorcode_string.go
@@ -4,6 +4,48 @@ package skyerr
 
 import "strconv"
 
+func _() {
+	// An "invalid array index" compiler error signifies that the constant values have changed.
+	// Re-run the stringer command to generate them again.
+	var x [1]struct{}
+	_ = x[NotAuthenticated-101]
+	_ = x[PermissionDenied-102]
+	_ = x[AccessKeyNotAccepted-103]
+	_ = x[AccessTokenNotAccepted-104]
+	_ = x[InvalidCredentials-105]
+	_ = x[InvalidSignature-106]
+	_ = x[BadRequest-107]
+	_ = x[InvalidArgument-108]
+	_ = x[Duplicated-109]
+	_ = x[ResourceNotFound-110]
+	_ = x[NotSupported-111]
+	_ = x[NotImplemented-112]
+	_ = x[ConstraintViolated-113]
+	_ = x[IncompatibleSchema-114]
+	_ = x[AtomicOperationFailure-115]
+	_ = x[PartialOperationFailure-116]
+	_ = x[UndefinedOperation-117]
+	_ = x[PluginUnavailable-118]
+	_ = x[PluginTimeout-119]
+	_ = x[RecordQueryInvalid-120]
+	_ = x[PluginInitializing-121]
+	_ = x[ResponseTimeout-122]
+	_ = x[DeniedArgument-123]
+	_ = x[RecordQueryDenied-124]
+	_ = x[NotConfigured-125]
+	_ = x[PasswordPolicyViolated-126]
+	_ = x[UserDisabled-127]
+	_ = x[VerificationRequired-128]
+	_ = x[AssetSizeTooLarge-129]
+	_ = x[HookTimeOut-130]
+	_ = x[UnexpectedError-10000]
+	_ = x[UnexpectedAuthInfoNotFound-10001]
+	_ = x[UnexpectedUnableToOpenDatabase-10002]
+	_ = x[UnexpectedPushNotificationNotConfigured-10003]
+	_ = x[InternalQueryInvalid-10004]
+	_ = x[UnexpectedUserNotFound-10005]
+}
+
 const (
 	_ErrorCode_name_0 = "NotAuthenticatedPermissionDeniedAccessKeyNotAcceptedAccessTokenNotAcceptedInvalidCredentialsInvalidSignatureBadRequestInvalidArgumentDuplicatedResourceNotFoundNotSupportedNotImplementedConstraintViolatedIncompatibleSchemaAtomicOperationFailurePartialOperationFailureUndefinedOperationPluginUnavailablePluginTimeoutRecordQueryInvalidPluginInitializingResponseTimeoutDeniedArgumentRecordQueryDeniedNotConfiguredPasswordPolicyViolatedUserDisabledVerificationRequiredAssetSizeTooLargeHookTimeOut"
 	_ErrorCode_name_1 = "UnexpectedErrorUnexpectedAuthInfoNotFoundUnexpectedUnableToOpenDatabaseUnexpectedPushNotificationNotConfiguredInternalQueryInvalidUnexpectedUserNotFound"
diff --git a/pkg/migrate/database/postgres/postgres.go b/pkg/migrate/database/postgres/postgres.go
index 40741bb0..bf420feb 100644
--- a/pkg/migrate/database/postgres/postgres.go
+++ b/pkg/migrate/database/postgres/postgres.go
@@ -263,6 +263,7 @@ func (p *Postgres) SetVersion(version int, dirty bool) error {
 	}
 
 	if version >= 0 {
+		// nolint:gosec
 		query = `INSERT INTO ` + pq.QuoteIdentifier(p.config.MigrationsTable) + ` (version, dirty) VALUES ($1, $2)`
 		if _, err := p.tx.Exec(query, version, dirty); err != nil {
 			p.tx.Rollback()
@@ -274,6 +275,7 @@ func (p *Postgres) SetVersion(version int, dirty bool) error {
 }
 
 func (p *Postgres) Version() (version int, dirty bool, err error) {
+	// nolint:gosec
 	query := `SELECT version, dirty FROM ` + pq.QuoteIdentifier(p.config.MigrationsTable) + ` LIMIT 1`
 	err = p.tx.QueryRowContext(context.Background(), query).Scan(&version, &dirty)
 	switch {


Test patch:
diff --git a/pkg/auth/dependency/audit/password_checker_test.go b/pkg/auth/dependency/audit/password_checker_test.go
index 43e8a983..870fd88c 100644
--- a/pkg/auth/dependency/audit/password_checker_test.go
+++ b/pkg/auth/dependency/audit/password_checker_test.go
@@ -429,6 +429,7 @@ func TestValidatePassword(t *testing.T) {
 	})
 
 	Convey("validate strong password", t, func() {
+		// nolint:gosec
 		password := "N!hon-no-tsuk!-wa-seka!-1ban-k!re!desu" // 日本の月は世界一番きれいです
 		pc := &PasswordChecker{
 			PwMinLength:         8,
diff --git a/pkg/core/inject/inject_test.go b/pkg/core/inject/inject_test.go
index a360b898..055ff1aa 100644
--- a/pkg/core/inject/inject_test.go
+++ b/pkg/core/inject/inject_test.go
@@ -13,6 +13,7 @@ import (
 type contextKey string
 
 var (
+	// nolint:deadcode
 	configurationKey = contextKey("configuration")
 )