Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
  • Loading branch information
Vladimir Popov committed Dec 10, 2020
1 parent cee2174 commit c4175c3
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,12 @@ issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- path: main.go
linters:
- funlen
text: "Function 'main' has too many statements"
- path: suite_setup_test.go
linters:
- funlen
text: "Function 'SetupSuite' is too long"
3 changes: 2 additions & 1 deletion .templateignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
README.md
README.md
.golangci.yml
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.15

require (
github.com/antonfisher/nested-logrus-formatter v1.3.0
github.com/edwarnicke/exechelper v1.0.2 // indirect
github.com/edwarnicke/exechelper v1.0.2
github.com/edwarnicke/grpcfd v0.0.0-20200920223154-d5b6e1f19bd0
github.com/golang/protobuf v1.4.3
github.com/kelseyhightower/envconfig v1.4.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/edwarnicke/exechelper v1.0.2 h1:dD49Ui2U0FBFxxhalnKw6vLS0P0TkgnXBRvKL/xmC5w=
github.com/edwarnicke/exechelper v1.0.2/go.mod h1:/T271jtNX/ND4De6pa2aRy2+8sNtyCDB1A2pp4M+fUs=
github.com/edwarnicke/grpcfd v0.0.0-20200920223154-d5b6e1f19bd0 h1:FHjcIM6YU8DnCw94+29EZX0bUqh016oqrtJrO8ZYiIY=
github.com/edwarnicke/grpcfd v0.0.0-20200920223154-d5b6e1f19bd0/go.mod h1:rHihB9YvNMixz8rS+ZbwosI2kj65VLkeyYAI2M+/cGA=
Expand Down Expand Up @@ -160,6 +161,7 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package config provides methods to get configuration parameters from environment variables
package config

import (
Expand Down
16 changes: 16 additions & 0 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// Copyright (c) 2020 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package config_test

import (
Expand Down
1 change: 0 additions & 1 deletion internal/imports/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
_ "github.com/networkservicemesh/api/pkg/api/networkservice/mechanisms/noop"
_ "github.com/networkservicemesh/api/pkg/api/networkservice/payload"
_ "github.com/networkservicemesh/api/pkg/api/registry"
_ "github.com/networkservicemesh/integration-k8s-packet/cmd/vfio-nse/internal/config"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/chains/endpoint"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/common/authorize"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms"
Expand Down
5 changes: 4 additions & 1 deletion internal/networkservice/mapserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package mapserver provides chain element implementing `network service -> { MAC, VLAN }` mapping
package mapserver

import (
"context"
"net"

"github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"

"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/networkservicemesh/sdk/pkg/networkservice/core/next"
"github.com/pkg/errors"

"github.com/networkservicemesh/cmd-nse-vfio/internal/config"
)
Expand All @@ -37,6 +39,7 @@ type entry struct {
vlanTag int32
}

// NewServer returns a new `network service -> { MAC, VLAN }` mapping server chain element
func NewServer(cfg *config.Config) networkservice.NetworkServiceServer {
s := &mapServer{
entries: make(map[string]*entry, len(cfg.Services)),
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func main() {
nsRegistryClient := registry.NewNetworkServiceRegistryClient(cc)
for i := range cfg.Services {
nsName := cfg.Services[i].Name
if _, err := nsRegistryClient.Register(ctx, &registry.NetworkService{
if _, err = nsRegistryClient.Register(ctx, &registry.NetworkService{
Name: nsName,
Payload: payload.Ethernet,
}); err != nil {
Expand Down

0 comments on commit c4175c3

Please sign in to comment.