Skip to content

Commit

Permalink
chore: format and linter settings (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik committed Oct 23, 2020
1 parent de5119a commit 3797331
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 21 deletions.
9 changes: 7 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
linters:
enable-all: false
disable-all: true
enable:
- gosec
- vet
- goimports
disable:
- vet
- structcheck

linters-settings:
goimports:
local-prefixes: github.com/ory/keto
6 changes: 4 additions & 2 deletions cmd/client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package client

import (
"context"
"time"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"google.golang.org/grpc"
"time"
)

const (
Expand All @@ -17,7 +18,8 @@ func GetGRPCConn(cmd *cobra.Command) (*grpc.ClientConn, error) {
if err != nil {
return nil, err
}
ctx, _ := context.WithTimeout(context.Background(), 3*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
return grpc.DialContext(ctx, remote, grpc.WithInsecure(), grpc.WithBlock())
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/relation/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package relation
import (
"context"
"fmt"

"github.com/spf13/cobra"

"github.com/ory/keto/cmd/client"
"github.com/ory/keto/models"
"github.com/spf13/cobra"
)

var getByUserRelationCmd = &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion cmd/relation/root.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package relation

import (
"github.com/ory/keto/cmd/client"
"github.com/spf13/cobra"

"github.com/ory/keto/cmd/client"
)

var relationCmd = &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ package cmd

import (
"fmt"
"github.com/ory/keto/cmd/relation"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/ory/keto/cmd/relation"

"github.com/spf13/cobra"

"github.com/ory/viper"
Expand Down
15 changes: 9 additions & 6 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ package cmd

import (
"fmt"
"net"
"net/http"
"os"
"sync"

"github.com/julienschmidt/httprouter"
"github.com/ory/graceful"
"github.com/spf13/cobra"
"google.golang.org/grpc"

"github.com/ory/keto/driver"
"github.com/ory/keto/models"
"github.com/ory/keto/relation"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"net"
"net/http"
"os"
"sync"

"github.com/ory/x/viperx"

Expand All @@ -46,6 +48,7 @@ on configuration options, open the configuration documentation:
>> https://github.com/ory/keto/blob/` + Version + `/docs/config.yaml <<`,
Run: func(cmd *cobra.Command, args []string) {
/* #nosec G102 - TODO this will be configurable */
lis, err := net.Listen("tcp", ":4467")
if err != nil {
fmt.Fprintf(cmd.ErrOrStderr(), "%+v\n", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func RunServe(
} else {
server.TLSConfig = &tls.Config{
Certificates: cert,
MinVersion: tls.VersionTLS10,
MinVersion: tls.VersionTLS13,
}
}

Expand Down
2 changes: 2 additions & 0 deletions doc_swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package main
// The standard error format
//
// swagger:response genericError
// nolint:deadcode,unused
type genericError struct {
// in: body
Body struct {
Expand All @@ -37,4 +38,5 @@ type genericError struct {
// An empty response
//
// swagger:response emptyResponse
// nolint:deadcode,unused
type emptyResponse struct{}
3 changes: 2 additions & 1 deletion driver/driver_default.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package driver

import (
"github.com/ory/keto/driver/configuration"
"github.com/ory/x/logrusx"

"github.com/ory/keto/driver/configuration"
)

type DefaultDriver struct {
Expand Down
3 changes: 2 additions & 1 deletion driver/registry_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package driver

import (
"github.com/ory/herodot"
"github.com/ory/x/logrusx"

"github.com/ory/keto/persistence/memory"
"github.com/ory/keto/relation"
"github.com/ory/keto/x"
"github.com/ory/x/logrusx"
)

var _ relation.ManagerProvider = &RegistryDefault{}
Expand Down
5 changes: 3 additions & 2 deletions models/relation.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions models/relation_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion persistence/memory/definitions.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package memory

import (
"sync"

"github.com/ory/keto/models"
"github.com/ory/keto/relation"
"sync"
)

type Persister struct {
Expand Down
1 change: 1 addition & 0 deletions persistence/memory/relations.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package memory

import (
"context"

"github.com/ory/keto/models"
)

Expand Down
1 change: 1 addition & 0 deletions relation/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package relation

import (
"context"

"github.com/ory/keto/models"
)

Expand Down
1 change: 1 addition & 0 deletions relation/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package relation

import (
"context"

"github.com/ory/keto/models"
)

Expand Down
6 changes: 4 additions & 2 deletions relation/handler.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package relation

import (
"net/http"

"github.com/julienschmidt/httprouter"
"github.com/ory/herodot"
"github.com/pkg/errors"

"github.com/ory/keto/models"
"github.com/ory/keto/x"
"github.com/pkg/errors"
"net/http"
)

type (
Expand Down

0 comments on commit 3797331

Please sign in to comment.