add(make): include gocritic checks with make critic
This commit is contained in:
8
Makefile
8
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: build realize dep spec protobuf test test.rbac qa qa.test qa.vet codegen
|
||||
.PHONY: build realize dep spec protobuf critic test test.rbac qa qa.test qa.vet codegen
|
||||
|
||||
PKG = "github.com/$(shell cat .project)"
|
||||
|
||||
@@ -11,6 +11,7 @@ SPEC = $(GOPATH)/bin/spec
|
||||
PROTOC = $(GOPATH)/bin/protoc-gen-go
|
||||
REALIZE = ${GOPATH}/bin/realize
|
||||
GOTEST = ${GOPATH}/bin/gotest
|
||||
GOCRITIC = ${GOPATH}/bin/gocritic
|
||||
|
||||
build:
|
||||
docker build --no-cache --rm -t $(shell cat .project) .
|
||||
@@ -39,6 +40,9 @@ protobuf: $(PROTOC)
|
||||
########################################################################################################################
|
||||
# QA
|
||||
|
||||
critic: $(GOCRITIC)
|
||||
$(GOCRITIC) check-project .
|
||||
|
||||
test: $(GOTEST)
|
||||
$(GOTEST) -cover -v ./...
|
||||
|
||||
@@ -70,6 +74,8 @@ $(SPEC):
|
||||
$(PROTOC):
|
||||
$(GOGET) github.com/golang/protobuf/protoc-gen-go
|
||||
|
||||
$(GOCRITIC):
|
||||
$(GOGET) github.com/go-critic/go-critic/...
|
||||
|
||||
clean.tools:
|
||||
rm -f $(SPEC) $(PROTOC) $(REALIZE)
|
||||
|
||||
@@ -89,7 +89,7 @@ func (c *Client) Delete(url string) (*http.Response, error) {
|
||||
return c.Request("DELETE", url, nil)
|
||||
}
|
||||
|
||||
func (c *Client) Request(method string, url string, body interface{}) (*http.Response, error) {
|
||||
func (c *Client) Request(method, url string, body interface{}) (*http.Response, error) {
|
||||
link := strings.TrimRight(c.config.baseURL, "/") + "/" + strings.TrimLeft(url, "/")
|
||||
|
||||
if c.debugLevel == "info" {
|
||||
|
||||
@@ -13,7 +13,7 @@ type (
|
||||
}
|
||||
|
||||
SessionsInterface interface {
|
||||
Create(sessionID string, username string, roles ...string) error
|
||||
Create(sessionID, username string, roles ...string) error
|
||||
Get(sessionID string) (*types.Session, error)
|
||||
Delete(sessionID string) error
|
||||
|
||||
@@ -30,7 +30,7 @@ const (
|
||||
sessionsDeactivateRole = "/sessions/%s/deactivateRole"
|
||||
)
|
||||
|
||||
func (u *Sessions) Create(sessionID string, username string, roles ...string) error {
|
||||
func (u *Sessions) Create(sessionID, username string, roles ...string) error {
|
||||
body := struct {
|
||||
Username string `json:"username"`
|
||||
Roles []string `json:"roles,omitempty"`
|
||||
|
||||
@@ -74,12 +74,12 @@ func (svc team) Unarchive(ctx context.Context, id uint64) error {
|
||||
return svc.repository.Unarchive(ctx, id)
|
||||
}
|
||||
|
||||
func (svc team) Merge(ctx context.Context, id uint64, targetTeamId uint64) error {
|
||||
func (svc team) Merge(ctx context.Context, id, targetTeamId uint64) error {
|
||||
// @todo: permission check if current user can merge team
|
||||
return svc.repository.Merge(ctx, id, targetTeamId)
|
||||
}
|
||||
|
||||
func (svc team) Move(ctx context.Context, id uint64, targetOrganisationId uint64) error {
|
||||
func (svc team) Move(ctx context.Context, id, targetOrganisationId uint64) error {
|
||||
// @todo: permission check if current user can move team to another organisation
|
||||
return svc.repository.Move(ctx, id, targetOrganisationId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user