diff --git a/cmd/commit.go b/cmd/commit.go index 3e3937c3dd8ed918ce4cbe57719a0ef4deeff8e6..a6ccb3b109b3c7f6afc4d7303c7c8ca88b196989 100644 --- a/cmd/commit.go +++ b/cmd/commit.go @@ -41,7 +41,7 @@ var commitCmd = &cobra.Command{ Use: "commit", Args: cobra.ExactArgs(1), Short: "Commit the given change for the active PND", - Long: ``, + Long: ``, RunE: func(cmd *cobra.Command, args []string) error { return cli.HTTPGet( apiEndpoint, diff --git a/cmd/confirm.go b/cmd/confirm.go index 4707a8e5e7460802a54e5ec9f8ae121591206a61..59cda76985aac03a9149da41a4e08f9545d0ac77 100644 --- a/cmd/confirm.go +++ b/cmd/confirm.go @@ -41,7 +41,7 @@ var confirmCmd = &cobra.Command{ Use: "confirm", Args: cobra.ExactArgs(1), Short: "Confirms the given change for the active PND", - Long: ``, + Long: ``, RunE: func(cmd *cobra.Command, args []string) error { return cli.HTTPGet( apiEndpoint, diff --git a/cmd/list.go b/cmd/list.go index 2e3a0ce52e18d3b457de393cda1869addc3715d5..198662268afafa640e5c73749c0f64899874188b 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -40,7 +40,7 @@ import ( var listCmd = &cobra.Command{ Use: "list", Short: "Lists all committed changes", - Long: ``, + Long: ``, RunE: func(cmd *cobra.Command, args []string) error { return cli.HTTPGet( apiEndpoint, diff --git a/cmd/listPending.go b/cmd/listPending.go index 4d5ece8fee0055c1b2d4439ace77680927789a4f..c7893d97bfe5e891c0ca90c9df4b44856b39f045 100644 --- a/cmd/listPending.go +++ b/cmd/listPending.go @@ -40,7 +40,7 @@ import ( var listPendingCmd = &cobra.Command{ Use: "listPending", Short: "Lists all committed changes", - Long: ``, + Long: ``, RunE: func(cmd *cobra.Command, args []string) error { return cli.HTTPGet( apiEndpoint, diff --git a/forks/goarista/gnmi/client.go b/forks/goarista/gnmi/client.go index fc041336eb078e224f739bbad9f93dd2767c10fb..c4512f2c8f6a3ef34b405ccfe81a33fcfcd57f72 100644 --- a/forks/goarista/gnmi/client.go +++ b/forks/goarista/gnmi/client.go @@ -118,7 +118,7 @@ func DialContext(ctx context.Context, cfg *Config) (pb.GNMIClient, error) { if cfg.TLS || cfg.CAFile != "" || cfg.CertFile != "" || cfg.Token != "" { tlsConfig := &tls.Config{ - MinVersion: tls.VersionTLS12, + MinVersion: tls.VersionTLS12, } if cfg.CAFile != "" { b, err := ioutil.ReadFile(cfg.CAFile) diff --git a/nucleus/gnmi_transport.go b/nucleus/gnmi_transport.go index 80441b0c6322b55d53569e1b15c3f35c28a7a9ba..d626a94b8ad0623248b9f1cbb2eac9634a216c35 100644 --- a/nucleus/gnmi_transport.go +++ b/nucleus/gnmi_transport.go @@ -23,14 +23,14 @@ const ( // CtxKeyOpts context key for gnmi.SubscribeOptions CtxKeyOpts CtxKeyType = "opts" // CtxKeyConfig is a context key for gnmi.Config - CtxKeyConfig = "config" + CtxKeyConfig = "config" CtxKeyOperation = "op" ) var opmap = map[Operation]string{ - TRANSPORT_UPDATE: "update", + TRANSPORT_UPDATE: "update", TRANSPORT_REPLACE: "replace", - TRANSPORT_DELETE: "delete", + TRANSPORT_DELETE: "delete", } // Gnmi implements the Transport interface and provides an SBI with the @@ -104,8 +104,8 @@ func (g *Gnmi) Set(ctx context.Context, args ...interface{}) error { } } - opts := make([]interface{},0) - for _,o := range args { + opts := make([]interface{}, 0) + for _, o := range args { attrs, ok := o.([]string) if !ok { return &ErrInvalidTypeAssertion{ @@ -122,8 +122,6 @@ func (g *Gnmi) Set(ctx context.Context, args ...interface{}) error { Val: attrs[1], }) } - - // Loop over args and create ops and exts // Invalid args cause unhealable error @@ -181,7 +179,9 @@ func (g *Gnmi) applyDiff(ctx context.Context, payload ...interface{}) error { } diff, err := ygot.Diff(oldstate, newstate) - if err != nil {return err} + if err != nil { + return err + } req := &gpb.SetRequest{} if diff.Update != nil { switch op { diff --git a/nucleus/pnd/initialise_test.go b/nucleus/pnd/initialise_test.go index ff7dcbf9f4d18c0087b6ff826d8cbe3835dae3e6..674656c8825327bac8c34ef84a8db6548ea2baaf 100644 --- a/nucleus/pnd/initialise_test.go +++ b/nucleus/pnd/initialise_test.go @@ -19,4 +19,4 @@ func TestMain(m *testing.M) { log.Fatal(err) } os.Exit(m.Run()) -} \ No newline at end of file +} diff --git a/nucleus/restconf_transport.go b/nucleus/restconf_transport.go index e1ae9fad723e70552e86562f759ee76fc3854f83..44411bf26586abbbbe7f499f122aa624d9d6e17d 100644 --- a/nucleus/restconf_transport.go +++ b/nucleus/restconf_transport.go @@ -37,4 +37,4 @@ func (r Restconf) GetOptions() interface{} { // ProcessResponse not yet implemented func (r Restconf) ProcessResponse(resp interface{}, root interface{}, models *ytypes.Schema) error { return &ErrNotYetImplemented{} -} \ No newline at end of file +} diff --git a/nucleus/util/path/translate.go b/nucleus/util/path/translate.go index 7b78f371f34d885d642f2bb348fd9457ceaed044..383abc80c0a9fa1ff5431acc01fe09fe89084363 100644 --- a/nucleus/util/path/translate.go +++ b/nucleus/util/path/translate.go @@ -5,12 +5,10 @@ import ( "strings" ) - - func FromString(path string) *gpb.Path { elements := strings.Split(path, delim) elem := make([]*gpb.PathElem, len(elements)) - for i,e := range elements { + for i, e := range elements { elem[i] = &gpb.PathElem{ Name: e, Key: nil, @@ -31,4 +29,3 @@ func ToStrings(path *gpb.Path) []string { } return elems } - diff --git a/test/integration/cmdIntegration_test.go b/test/integration/cmdIntegration_test.go index 0aefff4db74566a9dc411cc76de8c4965766570a..bb57a774ce0a63ec970bbfa6c1e82f06159b81ec 100644 --- a/test/integration/cmdIntegration_test.go +++ b/test/integration/cmdIntegration_test.go @@ -28,7 +28,6 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } - func testSetupIntegration() { if os.Getenv("GOSDN_LOG") == "nolog" { log.SetLevel(log.PanicLevel) diff --git a/test/integration/nucleusIntegration_test.go b/test/integration/nucleusIntegration_test.go index 960623c1de8b373cf0f4790220e876abb21fc49e..54f310491d161b597762bc4028e5bbfebd07c8f1 100644 --- a/test/integration/nucleusIntegration_test.go +++ b/test/integration/nucleusIntegration_test.go @@ -49,9 +49,9 @@ func TestGnmi_SetIntegration(t *testing.T) { name: "valid update", fields: fields{opt: opt}, args: args{ - ctx: context.Background(), + ctx: context.Background(), params: []string{"/system/config/hostname", "ceos3000"}, - }, + }, wantErr: false, }, }