Skip to content
Snippets Groups Projects
Commit f9bc8eba authored by Andre Sterba's avatar Andre Sterba
Browse files

Merge branch 'istaester/update-linter' into 'develop'

Use fixed linter version v1.42 and update rules

See merge request !200
parents 5b377787 d9e61f71
Branches
Tags
7 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!200Use fixed linter version v1.42 and update rules,!138Develop
Pipeline #84468 failed
...@@ -18,3 +18,6 @@ test/.terraform.local/ ...@@ -18,3 +18,6 @@ test/.terraform.local/
configs/gosdn.toml configs/gosdn.toml
api/api_test.toml api/api_test.toml
debug.test debug.test
# Binary
gosdn
...@@ -72,7 +72,6 @@ func Test_CommitConfirm(t *testing.T) { ...@@ -72,7 +72,6 @@ func Test_CommitConfirm(t *testing.T) {
return return
} }
log.Info(resp) log.Info(resp)
} }
func Test_AddDevice(t *testing.T) { func Test_AddDevice(t *testing.T) {
......
...@@ -112,7 +112,6 @@ func bufDialer(context.Context, string) (net.Conn, error) { ...@@ -112,7 +112,6 @@ func bufDialer(context.Context, string) (net.Conn, error) {
return lis.Dial() return lis.Dial()
} }
const unreachable = "203.0.113.10:6030"
const testPath = "/system/config/hostname" const testPath = "/system/config/hostname"
var testAddress = "141.100.70.170:6030" var testAddress = "141.100.70.170:6030"
......
code-quality: code-quality:
image: golangci/golangci-lint:latest-alpine image: golangci/golangci-lint:v1.42-alpine
stage: test stage: test
rules: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
......
...@@ -27,9 +27,13 @@ linters: ...@@ -27,9 +27,13 @@ linters:
enable: enable:
- gofmt - gofmt
- goimports - goimports
- revive
- gocyclo - gocyclo
- govet - govet
- unused
- staticcheck
- typecheck
- revive
- whitespace
issues: issues:
exclude-use-default: false exclude-use-default: false
max-issues-per-linter: 0 max-issues-per-linter: 0
......
...@@ -90,6 +90,9 @@ func startGrpc() error { ...@@ -90,6 +90,9 @@ func startGrpc() error {
orchestrator := viper.GetString("csbi-orchestrator") orchestrator := viper.GetString("csbi-orchestrator")
conn, err := grpc.Dial(orchestrator, grpc.WithInsecure()) conn, err := grpc.Dial(orchestrator, grpc.WithInsecure())
if err != nil {
log.Fatal(err)
}
c.csbiClient = cpb.NewCsbiClient(conn) c.csbiClient = cpb.NewCsbiClient(conn)
return nil return nil
} }
......
...@@ -6,7 +6,6 @@ import ( ...@@ -6,7 +6,6 @@ import (
) )
func Test_httpApi(t *testing.T) { func Test_httpApi(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
request string request string
......
...@@ -349,13 +349,6 @@ func handleSetOnd(pnd networkdomain.NetworkDomain, req []*ppb.SetOnd) (*ppb.SetR ...@@ -349,13 +349,6 @@ func handleSetOnd(pnd networkdomain.NetworkDomain, req []*ppb.SetOnd) (*ppb.SetR
}, nil }, nil
} }
func handleSetSbi(pnd networkdomain.NetworkDomain, req []*ppb.SetSbi) (*ppb.SetResponse, error) {
return &ppb.SetResponse{
Timestamp: time.Now().UnixNano(),
Status: ppb.SetResponse_ERROR,
}, nil
}
func handleSetChange(pnd networkdomain.NetworkDomain, req []*ppb.SetChange) (*ppb.SetResponse, error) { func handleSetChange(pnd networkdomain.NetworkDomain, req []*ppb.SetChange) (*ppb.SetResponse, error) {
for _, r := range req { for _, r := range req {
cuid, err := uuid.Parse(r.Cuid) cuid, err := uuid.Parse(r.Cuid)
......
...@@ -132,7 +132,6 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, < ...@@ -132,7 +132,6 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <
errChan <- err errChan <- err
} }
errChan <- fmt.Errorf("change %v timed out", ch.cuid) errChan <- fmt.Errorf("change %v timed out", ch.cuid)
break
case s := <-stateIn: case s := <-stateIn:
switch s { switch s {
case ppb.Change_COMMITTED: case ppb.Change_COMMITTED:
......
...@@ -9,8 +9,6 @@ import ( ...@@ -9,8 +9,6 @@ import (
"code.fbi.h-da.de/danet/gosdn/interfaces/southbound" "code.fbi.h-da.de/danet/gosdn/interfaces/southbound"
"google.golang.org/grpc"
ppb "code.fbi.h-da.de/danet/api/go/gosdn/pnd" ppb "code.fbi.h-da.de/danet/api/go/gosdn/pnd"
"code.fbi.h-da.de/danet/forks/goarista/gnmi" "code.fbi.h-da.de/danet/forks/goarista/gnmi"
...@@ -71,10 +69,6 @@ func newGnmiTransport(opts *tpb.TransportOption, sbi southbound.SouthboundInterf ...@@ -71,10 +69,6 @@ func newGnmiTransport(opts *tpb.TransportOption, sbi southbound.SouthboundInterf
}, nil }, nil
} }
func parseDialOptions(opts map[string]string) []grpc.DialOption {
return nil
}
// Get takes a slice of gnmi paths, splits them and calls get for each one of them. // Get takes a slice of gnmi paths, splits them and calls get for each one of them.
func (g *Gnmi) Get(ctx context.Context, params ...string) (interface{}, error) { func (g *Gnmi) Get(ctx context.Context, params ...string) (interface{}, error) {
if g.client == nil { if g.client == nil {
......
...@@ -320,6 +320,7 @@ func (pnd *pndImplementation) ChangeOND(duid uuid.UUID, operation ppb.ApiOperati ...@@ -320,6 +320,7 @@ func (pnd *pndImplementation) ChangeOND(duid uuid.UUID, operation ppb.ApiOperati
return ch.cuid, nil return ch.cuid, nil
} }
// nolint will be implemented in the near future
func handleRollbackError(id uuid.UUID, err error) { func handleRollbackError(id uuid.UUID, err error) {
log.Error(err) log.Error(err)
// TODO: Notion of invalid state needed. // TODO: Notion of invalid state needed.
......
...@@ -693,7 +693,6 @@ func Test_pndImplementation_GetDevice(t *testing.T) { ...@@ -693,7 +693,6 @@ func Test_pndImplementation_GetDevice(t *testing.T) {
t.Errorf("GetDevice() got = %v, want %v", foundDevice.(device.Device).Model(), tt.want) t.Errorf("GetDevice() got = %v, want %v", foundDevice.(device.Device).Model(), tt.want)
} }
} }
}) })
} }
} }
...@@ -744,7 +743,6 @@ func Test_pndImplementation_GetDeviceByName(t *testing.T) { ...@@ -744,7 +743,6 @@ func Test_pndImplementation_GetDeviceByName(t *testing.T) {
t.Errorf("GetDeviceByName() got = %v, want %v", foundDevice.(device.Device).Model(), tt.want) t.Errorf("GetDeviceByName() got = %v, want %v", foundDevice.(device.Device).Model(), tt.want)
} }
} }
}) })
} }
} }
......
...@@ -6,8 +6,6 @@ import ( ...@@ -6,8 +6,6 @@ import (
spb "code.fbi.h-da.de/danet/api/go/gosdn/southbound" spb "code.fbi.h-da.de/danet/api/go/gosdn/southbound"
"code.fbi.h-da.de/danet/gosdn/interfaces/transport"
"code.fbi.h-da.de/danet/gosdn/nucleus/util/path" "code.fbi.h-da.de/danet/gosdn/nucleus/util/path"
"code.fbi.h-da.de/danet/gosdn/nucleus/util/proto" "code.fbi.h-da.de/danet/gosdn/nucleus/util/proto"
"code.fbi.h-da.de/danet/yang-models/generated/openconfig" "code.fbi.h-da.de/danet/yang-models/generated/openconfig"
...@@ -19,9 +17,8 @@ import ( ...@@ -19,9 +17,8 @@ import (
func TestOpenConfig_Id(t *testing.T) { func TestOpenConfig_Id(t *testing.T) {
type fields struct { type fields struct {
transport transport.Transport schema *ytypes.Schema
schema *ytypes.Schema id uuid.UUID
id uuid.UUID
} }
tests := []struct { tests := []struct {
name string name string
......
...@@ -29,7 +29,6 @@ func NewTransport(opts *tpb.TransportOption, sbi southbound.SouthboundInterface) ...@@ -29,7 +29,6 @@ func NewTransport(opts *tpb.TransportOption, sbi southbound.SouthboundInterface)
return newGnmiTransport(opts, sbi) return newGnmiTransport(opts, sbi)
default: default:
return nil, &errors.ErrInvalidTransportOptions{Opt: o} return nil, &errors.ErrInvalidTransportOptions{Opt: o}
} }
} }
......
...@@ -71,7 +71,6 @@ func processEntry(e *yang.Entry) *Element { ...@@ -71,7 +71,6 @@ func processEntry(e *yang.Entry) *Element {
// Strings constructs a slice containg all possible root to leaf paths. // Strings constructs a slice containg all possible root to leaf paths.
// Calls stringBuilder internally // Calls stringBuilder internally
func Strings(paths map[string]*Element) []string { func Strings(paths map[string]*Element) []string {
p := make([]string, 0)
ch := make(chan string) ch := make(chan string)
stop := make(chan bool) stop := make(chan bool)
val := make(chan []string) val := make(chan []string)
...@@ -81,7 +80,8 @@ func Strings(paths map[string]*Element) []string { ...@@ -81,7 +80,8 @@ func Strings(paths map[string]*Element) []string {
stringBuilder(ch, &b, v) stringBuilder(ch, &b, v)
} }
stop <- true stop <- true
p = <-val p := <-val
return p return p
} }
...@@ -95,7 +95,6 @@ func appendix(c chan string, stop chan bool, pathChan chan []string) { ...@@ -95,7 +95,6 @@ func appendix(c chan string, stop chan bool, pathChan chan []string) {
log.Debug(path) log.Debug(path)
case sig = <-stop: case sig = <-stop:
log.Debugf("Signal received: %v", sig) log.Debugf("Signal received: %v", sig)
} }
if sig { if sig {
break break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment