Commit fd2f3081 authored by pityonline's avatar pityonline Committed by Sander van Harmelen

Add CI lint stage, fix lint warnings (#377)

* ci: add lint stage to keep the code healthy

* fix golint warnings on type comment and Go Names

* fix Go Names even golint not complains

* remove testURL when testing with dynamic opt
parent 22895aa4
language: go language: go
go: go:
- 1.7.x - "1.7.x"
- 1.8.x - "1.8.x"
- 1.9.x - "1.9.x"
- "1.10" - "1.10.x"
- master - master
stages:
- lint
- test
jobs:
include:
- stage: lint
script:
- go get github.com/golang/lint/golint
- golint
- stage: test
script:
- go test -v
matrix: matrix:
allow_failures: allow_failures:
- go: master - go: master
......
...@@ -70,12 +70,11 @@ func TestListUserProjects(t *testing.T) { ...@@ -70,12 +70,11 @@ func TestListUserProjects(t *testing.T) {
} }
} }
func ListProjectsUsers_byID(t *testing.T) { func TestListProjectsUsersByID(t *testing.T) {
mux, server, client := setup() mux, server, client := setup()
defer teardown(server) defer teardown(server)
mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/projects/", func(w http.ResponseWriter, r *http.Request) {
testURL(t, r, "/projects/1/users")
testMethod(t, r, "GET") testMethod(t, r, "GET")
fmt.Fprint(w, `[{"id":1},{"id":2}]`) fmt.Fprint(w, `[{"id":1},{"id":2}]`)
}) })
...@@ -96,12 +95,11 @@ func ListProjectsUsers_byID(t *testing.T) { ...@@ -96,12 +95,11 @@ func ListProjectsUsers_byID(t *testing.T) {
} }
} }
func ListProjectsUsers_byName(t *testing.T) { func TestListProjectsUsersByName(t *testing.T) {
mux, server, client := setup() mux, server, client := setup()
defer teardown(server) defer teardown(server)
mux.HandleFunc("/projects/", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/projects/", func(w http.ResponseWriter, r *http.Request) {
testURL(t, r, "/projects/namespace%2Fname/users")
testMethod(t, r, "GET") testMethod(t, r, "GET")
fmt.Fprint(w, `[{"id":1},{"id":2}]`) fmt.Fprint(w, `[{"id":1},{"id":2}]`)
}) })
...@@ -184,7 +182,7 @@ func TestListStarredProjects(t *testing.T) { ...@@ -184,7 +182,7 @@ func TestListStarredProjects(t *testing.T) {
} }
} }
func TestGetProject_byID(t *testing.T) { func TestGetProjectByID(t *testing.T) {
mux, server, client := setup() mux, server, client := setup()
defer teardown(server) defer teardown(server)
...@@ -204,7 +202,7 @@ func TestGetProject_byID(t *testing.T) { ...@@ -204,7 +202,7 @@ func TestGetProject_byID(t *testing.T) {
} }
} }
func TestGetProject_byName(t *testing.T) { func TestGetProjectByName(t *testing.T) {
mux, server, client := setup() mux, server, client := setup()
defer teardown(server) defer teardown(server)
......
...@@ -39,6 +39,9 @@ type Tag struct { ...@@ -39,6 +39,9 @@ type Tag struct {
Message string `json:"message"` Message string `json:"message"`
} }
// Release represents a GitLab version release.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
type Release struct { type Release struct {
TagName string `json:"tag_name"` TagName string `json:"tag_name"`
Description string `json:"description"` Description string `json:"description"`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment