Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update package name and upgrade gin #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions articles/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package articles

import (
_ "fmt"
"github.com/jinzhu/gorm"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"github.com/wangzitian0/golang-gin-starter-kit/users"
"strconv"

"github.com/gothinkster/golang-gin-realworld-example-app/common"
"github.com/gothinkster/golang-gin-realworld-example-app/users"
"github.com/jinzhu/gorm"
)

type ArticleModel struct {
Expand Down
7 changes: 4 additions & 3 deletions articles/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package articles

import (
"errors"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"github.com/wangzitian0/golang-gin-starter-kit/users"
"gopkg.in/gin-gonic/gin.v1"
"net/http"
"strconv"

"github.com/gin-gonic/gin"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need use the dev version? Version related issue I think govendor is better and enough, https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/vendor/vendor.json

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now gin no longer gopkg style, use govendor fetch github.com/gin-gonic/[email protected] can get v1.3.x branch not develop version.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got, I have half year not write go...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, thanks a lot!

"github.com/gothinkster/golang-gin-realworld-example-app/common"
"github.com/gothinkster/golang-gin-realworld-example-app/users"
)

func ArticlesRegister(router *gin.RouterGroup) {
Expand Down
4 changes: 2 additions & 2 deletions articles/serializers.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package articles

import (
"github.com/gin-gonic/gin"
"github.com/gosimple/slug"
"github.com/wangzitian0/golang-gin-starter-kit/users"
"gopkg.in/gin-gonic/gin.v1"
"github.com/gothinkster/golang-gin-realworld-example-app/users"
)

type TagSerializer struct {
Expand Down
6 changes: 3 additions & 3 deletions articles/validators.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package articles

import (
"github.com/gin-gonic/gin"
"github.com/gosimple/slug"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"github.com/wangzitian0/golang-gin-starter-kit/users"
"gopkg.in/gin-gonic/gin.v1"
"github.com/gothinkster/golang-gin-realworld-example-app/common"
"github.com/gothinkster/golang-gin-realworld-example-app/users"
)

type ArticleModelValidator struct {
Expand Down
3 changes: 2 additions & 1 deletion common/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package common

import (
"fmt"
"os"

"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"os"
)

type Database struct {
Expand Down
5 changes: 3 additions & 2 deletions common/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package common
import (
"bytes"
"errors"
"github.com/stretchr/testify/assert"
"gopkg.in/gin-gonic/gin.v1"
"net/http"
"net/http/httptest"
"os"
"testing"

"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)

func TestConnectingDatabase(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (
"math/rand"
"time"

"github.com/dgrijalva/jwt-go"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure? Might cause error can'f find jwt? I think we should delete all package in the vendor or GOPATH, and make sure all packages can be installed in a new environment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I make sure it later on.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, travis CI should do the work... but the gothinkster's repo didn't get right config... Let's wait Eric reply..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

"gopkg.in/go-playground/validator.v8"

"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"gopkg.in/gin-gonic/gin.v1"
)

var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
Expand Down
9 changes: 4 additions & 5 deletions hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package main
import (
"fmt"

"gopkg.in/gin-gonic/gin.v1"

"github.com/gin-gonic/gin"
"github.com/gothinkster/golang-gin-realworld-example-app/articles"
"github.com/gothinkster/golang-gin-realworld-example-app/common"
"github.com/gothinkster/golang-gin-realworld-example-app/users"
"github.com/jinzhu/gorm"
"github.com/wangzitian0/golang-gin-starter-kit/articles"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"github.com/wangzitian0/golang-gin-starter-kit/users"
)

func Migrate(db *gorm.DB) {
Expand Down
9 changes: 5 additions & 4 deletions users/middlewares.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package users

import (
"github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/request"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"gopkg.in/gin-gonic/gin.v1"
"net/http"
"strings"

jwt "github.com/dgrijalva/jwt-go"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Codes LGTM, but please make sure it works fine in new environment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, make sure later on.

"github.com/dgrijalva/jwt-go/request"
"github.com/gin-gonic/gin"
"github.com/gothinkster/golang-gin-realworld-example-app/common"
)

// Strips 'TOKEN ' prefix from token string
Expand Down
3 changes: 2 additions & 1 deletion users/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package users

import (
"errors"

"github.com/gothinkster/golang-gin-realworld-example-app/common"
"github.com/jinzhu/gorm"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"golang.org/x/crypto/bcrypt"
)

Expand Down
5 changes: 3 additions & 2 deletions users/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package users

import (
"errors"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"gopkg.in/gin-gonic/gin.v1"
"net/http"

"github.com/gin-gonic/gin"
"github.com/gothinkster/golang-gin-realworld-example-app/common"
)

func UsersRegister(router *gin.RouterGroup) {
Expand Down
5 changes: 2 additions & 3 deletions users/serializers.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package users

import (
"gopkg.in/gin-gonic/gin.v1"

"github.com/wangzitian0/golang-gin-starter-kit/common"
"github.com/gin-gonic/gin"
"github.com/gothinkster/golang-gin-realworld-example-app/common"
)

type ProfileSerializer struct {
Expand Down
12 changes: 6 additions & 6 deletions users/unit_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package users

import (
"github.com/stretchr/testify/assert"
"testing"

"bytes"
"fmt"
"github.com/jinzhu/gorm"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"gopkg.in/gin-gonic/gin.v1"
"net/http"
"net/http/httptest"
"os"
_ "regexp"
"testing"

"github.com/gin-gonic/gin"
"github.com/gothinkster/golang-gin-realworld-example-app/common"
"github.com/jinzhu/gorm"
"github.com/stretchr/testify/assert"
)

var image_url = "https://golang.org/doc/gopher/frontpage.png"
Expand Down
4 changes: 2 additions & 2 deletions users/validators.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package users

import (
"github.com/wangzitian0/golang-gin-starter-kit/common"
"gopkg.in/gin-gonic/gin.v1"
"github.com/gin-gonic/gin"
"github.com/gothinkster/golang-gin-realworld-example-app/common"
)

// *ModelValidator containing two parts:
Expand Down
80 changes: 47 additions & 33 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"revisionTime": "2017-04-10T16:13:40Z"
},
{
"checksumSHA1": "mrz/kicZiUaHxkyfvC/DyQcr8Do=",
"checksumSHA1": "CSPbwbyzqA6sfORicn4HFtIhF/c=",
"path": "github.com/davecgh/go-spew/spew",
"revision": "adab96458c51a58dc1783b3335dcce5461522e75",
"revisionTime": "2017-07-11T18:34:51Z"
"revision": "8991bc29aa16c548c550c7ff78260e27b9ab7c73",
"revisionTime": "2018-02-21T22:46:20Z"
},
{
"checksumSHA1": "GXOurDGgsLmJs0wounpdWZZRSGw=",
Expand All @@ -39,22 +39,36 @@
"revisionTime": "2017-05-29T06:23:10Z"
},
{
"checksumSHA1": "g1ULoqYPmgLWhNTimHlM5usWZ1s=",
"checksumSHA1": "90S9sFqcIo/uuwQzz1t/wYs7GEs=",
"path": "github.com/gin-gonic/gin",
"revision": "93b3a0d7ec95c33dc327397ab1756c36853328ee",
"revisionTime": "2017-07-16T03:42:08Z"
"revision": "b869fe1415e4b9eb52f247441830d502aece2d4d",
"revisionTime": "2018-08-14T08:58:52Z",
"version": "v1.3",
"versionExact": "v1.3.0"
},
{
"checksumSHA1": "A09l4+1MIuaXhh3Nn6aoOm+rr3Q=",
"checksumSHA1": "BjShmaQTKI8+411rCb7LFqJkLA0=",
"path": "github.com/gin-gonic/gin/binding",
"revision": "aa6d2d29f8ac39c365aa5b72fdec01029b0d5264",
"revisionTime": "2017-07-11T15:28:08Z"
"revision": "b869fe1415e4b9eb52f247441830d502aece2d4d",
"revisionTime": "2018-08-14T08:58:52Z",
"version": "v1.3",
"versionExact": "v1.3.0"
},
{
"checksumSHA1": "8UlyJTegyrXbE8UErbf2lH7X4AM=",
"checksumSHA1": "woO1qIxIeQ1bcbPSiMfAKk3r4xg=",
"path": "github.com/gin-gonic/gin/json",
"revision": "b869fe1415e4b9eb52f247441830d502aece2d4d",
"revisionTime": "2018-08-14T08:58:52Z",
"version": "v1.3",
"versionExact": "v1.3.0"
},
{
"checksumSHA1": "f1n8P2YAi3o+X0//dkoDJ822zW0=",
"path": "github.com/gin-gonic/gin/render",
"revision": "aa6d2d29f8ac39c365aa5b72fdec01029b0d5264",
"revisionTime": "2017-07-11T15:28:08Z"
"revision": "b869fe1415e4b9eb52f247441830d502aece2d4d",
"revisionTime": "2018-08-14T08:58:52Z",
"version": "v1.3",
"versionExact": "v1.3.0"
},
{
"checksumSHA1": "pI0js2qnSKXOzUq9AoA5CJDJNRw=",
Expand Down Expand Up @@ -117,10 +131,10 @@
"revisionTime": "2017-07-11T23:04:30Z"
},
{
"checksumSHA1": "U6lX43KDDlNOn+Z0Yyww+ZzHfFo=",
"checksumSHA1": "w5RcOnfv5YDr3j2bd1YydkPiZx4=",
"path": "github.com/mattn/go-isatty",
"revision": "fc9e8d8ef48496124e79ae0df75490096eccf6fe",
"revisionTime": "2017-03-22T23:44:13Z"
"revision": "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c",
"revisionTime": "2017-11-07T05:05:31Z"
},
{
"checksumSHA1": "CmknXrMVBRJrx4LsIA9jEOmsLQQ=",
Expand All @@ -141,28 +155,34 @@
"revisionTime": "2015-09-07T02:38:54Z"
},
{
"checksumSHA1": "K0crHygPTP42i1nLKWphSlvOQJw=",
"checksumSHA1": "BBudH/js1dNI/nEfTwsAYUo9l2M=",
"path": "github.com/stretchr/objx",
"revision": "1a9d0bb9f541897e62256577b352fdbc1fb4fd94",
"revisionTime": "2015-09-28T12:21:52Z"
"revision": "ef50b0de28773081167c97fc27cf29a0bf8b8c71",
"revisionTime": "2018-08-25T06:49:32Z"
},
{
"checksumSHA1": "nj123dGxKPIF17B6y3VEK2pihRk=",
"path": "github.com/stretchr/testify",
"revision": "f35b8ab0b5a2cef36673838d662e249dd9c94686",
"revisionTime": "2018-05-06T18:05:49Z"
},
{
"checksumSHA1": "J+ppEq6nYMKxhB9+c+MD1x9UwSc=",
"checksumSHA1": "c6pbpF7eowwO59phRTpF8cQ80Z0=",
"path": "github.com/stretchr/testify/assert",
"revision": "05e8a0eda380579888eb53c394909df027f06991",
"revisionTime": "2017-07-13T16:51:06Z"
"revision": "f35b8ab0b5a2cef36673838d662e249dd9c94686",
"revisionTime": "2018-05-06T18:05:49Z"
},
{
"checksumSHA1": "fg3TzS9/QK3wZbzei3Z6O8XPLHg=",
"path": "github.com/stretchr/testify/http",
"revision": "05e8a0eda380579888eb53c394909df027f06991",
"revisionTime": "2017-07-13T16:51:06Z"
"revision": "f35b8ab0b5a2cef36673838d662e249dd9c94686",
"revisionTime": "2018-05-06T18:05:49Z"
},
{
"checksumSHA1": "o+jsS/rxceTym4M3reSPfrPxaio=",
"checksumSHA1": "WmBSFdqpdYRIkp0I408JIZ3LDMY=",
"path": "github.com/stretchr/testify/mock",
"revision": "05e8a0eda380579888eb53c394909df027f06991",
"revisionTime": "2017-07-13T16:51:06Z"
"revision": "f35b8ab0b5a2cef36673838d662e249dd9c94686",
"revisionTime": "2018-05-06T18:05:49Z"
},
{
"checksumSHA1": "9Zw986fuQM/hCoVd8vmHoSM+8sU=",
Expand All @@ -182,12 +202,6 @@
"revision": "abf9c25f54453410d0c6668e519582a9e1115027",
"revisionTime": "2017-07-10T15:57:01Z"
},
{
"checksumSHA1": "lqXx4OhLBZFV5p4+I0OvpNabF4A=",
"path": "gopkg.in/gin-gonic/gin.v1",
"revision": "d459835d2b077e44f7c9b453505ee29881d5d12d",
"revisionTime": "2017-07-02T09:28:26Z"
},
{
"checksumSHA1": "39V1idWER42Lmcmg2Uy40wMzOlo=",
"path": "gopkg.in/go-playground/validator.v8",
Expand All @@ -207,5 +221,5 @@
"revisionTime": "2017-07-12T05:45:46Z"
}
],
"rootPath": "github.com/wangzitian0/golang-gin-starter-kit"
"rootPath": "github.com/gothinkster/golang-gin-realworld-example-app"
}