From 63e97e127ca1834e4faff8c84d25a7b668e84484 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 13 Aug 2021 22:21:17 +0800 Subject: [PATCH] Add gitea-vet (#312) use gitea-vet to apply gitea specific vet rules Co-authored-by: 6543 <6543@noreply.gitea.io> Co-authored-by: techknowlogick Co-authored-by: Andrew Thornton Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/312 Reviewed-by: Andrew Thornton Reviewed-by: KN4CK3R Co-authored-by: 6543 <6543@obermui.de> Co-committed-by: 6543 <6543@obermui.de> --- .gitignore | 1 + Makefile | 8 +++++++- gitea/go.mod | 1 + gitea/go.sum | 22 ++++++++++++++++++++-- gitea/issue_comment_test.go | 3 ++- gitea/repo_stars_test.go | 3 ++- 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 81a2c4d..dc41027 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ _cgo_gotypes.go _cgo_export.* _testmain.go +gitea-vet *.exe *.test diff --git a/Makefile b/Makefile index f08f06b..0b3cd15 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ GITEA_SDK_TEST_URL ?= http://localhost:3000 GITEA_SDK_TEST_USERNAME ?= test01 GITEA_SDK_TEST_PASSWORD ?= test01 +PACKAGE := code.gitea.io/sdk/gitea GITEA_DL := https://dl.gitea.io/gitea/main/gitea-main- UNAME_S := $(shell uname -s) @@ -57,7 +58,12 @@ fmt: .PHONY: vet vet: - cd gitea && $(GO) vet ./... + # Default vet + cd gitea && $(GO) vet $(PACKAGE) + # Custom vet + cd gitea && $(GO) get code.gitea.io/gitea-vet + cd gitea && $(GO) build code.gitea.io/gitea-vet + cd gitea && $(GO) vet -vettool=gitea-vet $(PACKAGE) .PHONY: lint lint: diff --git a/gitea/go.mod b/gitea/go.mod index ac2a262..7141bfa 100644 --- a/gitea/go.mod +++ b/gitea/go.mod @@ -3,6 +3,7 @@ module code.gitea.io/sdk/gitea go 1.13 require ( + code.gitea.io/gitea-vet v0.2.1 // indirect github.com/hashicorp/go-version v1.2.1 github.com/stretchr/testify v1.4.0 ) diff --git a/gitea/go.sum b/gitea/go.sum index 82997d0..833e391 100644 --- a/gitea/go.sum +++ b/gitea/go.sum @@ -1,7 +1,7 @@ +code.gitea.io/gitea-vet v0.2.1 h1:b30by7+3SkmiftK0RjuXqFvZg2q4p68uoPGuxhzBN0s= +code.gitea.io/gitea-vet v0.2.1/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE= 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/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -9,6 +9,24 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224 h1:azwY/v0y0K4mFHVsg5+UrTgchqALYWpqVo6vL5OmkmI= +golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= diff --git a/gitea/issue_comment_test.go b/gitea/issue_comment_test.go index 226e6f6..10a96d0 100644 --- a/gitea/issue_comment_test.go +++ b/gitea/issue_comment_test.go @@ -5,9 +5,10 @@ package gitea import ( - "github.com/stretchr/testify/assert" "log" "testing" + + "github.com/stretchr/testify/assert" ) // TestIssueComment creat a issue and test comment creation/edit/deletion on it diff --git a/gitea/repo_stars_test.go b/gitea/repo_stars_test.go index 964eab1..d677e8c 100644 --- a/gitea/repo_stars_test.go +++ b/gitea/repo_stars_test.go @@ -5,9 +5,10 @@ package gitea import ( - "github.com/stretchr/testify/assert" "log" "testing" + + "github.com/stretchr/testify/assert" ) func TestRepoStaring(t *testing.T) {