Skip to content
Snippets Groups Projects
Commit 59aec7f3 authored by Malte Bauch's avatar Malte Bauch
Browse files

fixing simple linting errors:

- File is not `gofmt`-ed
- Package comment should be of the form ...
parent bca99cb4
Branches
Tags
2 merge requests!120Resolve "Code Quality",!90Develop
...@@ -28,6 +28,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ...@@ -28,6 +28,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
package cmd package cmd
import ( import (
...@@ -39,7 +40,7 @@ import ( ...@@ -39,7 +40,7 @@ import (
var utilCmd = &cobra.Command{ var utilCmd = &cobra.Command{
Use: "util", Use: "util",
Short: "multiple ygot utils - not yet implemented", Short: "multiple ygot utils - not yet implemented",
Long: ``, Long: ``,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return errors.New("not implemented") return errors.New("not implemented")
}, },
......
...@@ -28,6 +28,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ...@@ -28,6 +28,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
package cmd package cmd
import ( import (
...@@ -40,7 +41,7 @@ import ( ...@@ -40,7 +41,7 @@ import (
var ygotCmd = &cobra.Command{ var ygotCmd = &cobra.Command{
Use: "ygot", Use: "ygot",
Short: "multiple ygot utils - not yet implemented", Short: "multiple ygot utils - not yet implemented",
Long: ``, Long: ``,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return errors.New("not implemented") return errors.New("not implemented")
}, },
......
...@@ -273,8 +273,8 @@ func TestGnmi_SubscribeIntegration(t *testing.T) { ...@@ -273,8 +273,8 @@ func TestGnmi_SubscribeIntegration(t *testing.T) {
go func() { go func() {
err = g.Subscribe(ctx) err = g.Subscribe(ctx)
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {
if !tt.wantErr{ if !tt.wantErr {
if err.Error() != "rpc error: code = Canceled desc = context canceled"{ if err.Error() != "rpc error: code = Canceled desc = context canceled" {
t.Errorf("Subscribe() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("Subscribe() error = %v, wantErr %v", err, tt.wantErr)
} }
} }
......
...@@ -35,8 +35,8 @@ func TestOpenConfig_Id(t *testing.T) { ...@@ -35,8 +35,8 @@ func TestOpenConfig_Id(t *testing.T) {
{ {
name: "default", name: "default",
fields: fields{ fields: fields{
schema: nil, schema: nil,
id: ocUUID, id: ocUUID,
}, },
want: ocUUID, want: ocUUID,
}, },
...@@ -44,8 +44,8 @@ func TestOpenConfig_Id(t *testing.T) { ...@@ -44,8 +44,8 @@ func TestOpenConfig_Id(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{ oc := &OpenConfig{
schema: tt.fields.schema, schema: tt.fields.schema,
id: tt.fields.id, id: tt.fields.id,
} }
if got := oc.Id(); !reflect.DeepEqual(got, tt.want) { if got := oc.Id(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Id() = %v, want %v", got, tt.want) t.Errorf("Id() = %v, want %v", got, tt.want)
...@@ -56,8 +56,8 @@ func TestOpenConfig_Id(t *testing.T) { ...@@ -56,8 +56,8 @@ func TestOpenConfig_Id(t *testing.T) {
func TestOpenConfig_SbiIdentifier(t *testing.T) { func TestOpenConfig_SbiIdentifier(t *testing.T) {
type fields struct { type fields struct {
schema *ytypes.Schema schema *ytypes.Schema
id uuid.UUID id uuid.UUID
} }
tests := []struct { tests := []struct {
name string name string
...@@ -69,8 +69,8 @@ func TestOpenConfig_SbiIdentifier(t *testing.T) { ...@@ -69,8 +69,8 @@ func TestOpenConfig_SbiIdentifier(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{ oc := &OpenConfig{
schema: tt.fields.schema, schema: tt.fields.schema,
id: tt.fields.id, id: tt.fields.id,
} }
if got := oc.SbiIdentifier(); got != tt.want { if got := oc.SbiIdentifier(); got != tt.want {
t.Errorf("SbiIdentifier() = %v, want %v", got, tt.want) t.Errorf("SbiIdentifier() = %v, want %v", got, tt.want)
...@@ -85,8 +85,8 @@ func TestOpenConfig_Schema(t *testing.T) { ...@@ -85,8 +85,8 @@ func TestOpenConfig_Schema(t *testing.T) {
t.Error(err) t.Error(err)
} }
type fields struct { type fields struct {
schema *ytypes.Schema schema *ytypes.Schema
id uuid.UUID id uuid.UUID
} }
tests := []struct { tests := []struct {
name string name string
...@@ -98,8 +98,8 @@ func TestOpenConfig_Schema(t *testing.T) { ...@@ -98,8 +98,8 @@ func TestOpenConfig_Schema(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{ oc := &OpenConfig{
schema: tt.fields.schema, schema: tt.fields.schema,
id: tt.fields.id, id: tt.fields.id,
} }
got := oc.Schema().SchemaTree got := oc.Schema().SchemaTree
if !reflect.DeepEqual(got, tt.want.SchemaTree) { if !reflect.DeepEqual(got, tt.want.SchemaTree) {
......
...@@ -8,9 +8,9 @@ import ( ...@@ -8,9 +8,9 @@ import (
"strings" "strings"
) )
const DELIM = "/" const delim = "/"
// PathElement represents a node in a path containing its name and possible child nodes // Element represents a node in a path containing its name and possible child nodes
type Element struct { type Element struct {
Children []*Element Children []*Element
Name string Name string
...@@ -105,11 +105,11 @@ func appendix(c chan string, stop chan bool, pathChan chan []string) { ...@@ -105,11 +105,11 @@ func appendix(c chan string, stop chan bool, pathChan chan []string) {
func stringBuilder(ch chan string, b *strings.Builder, v *Element) { func stringBuilder(ch chan string, b *strings.Builder, v *Element) {
if b.Len() == 0 { if b.Len() == 0 {
b.WriteString(DELIM) b.WriteString(delim)
} }
b.WriteString(v.Name) b.WriteString(v.Name)
if v.Children != nil { if v.Children != nil {
b.WriteString(DELIM) b.WriteString(delim)
for _, c := range v.Children { for _, c := range v.Children {
var bCpy strings.Builder var bCpy strings.Builder
bCpy.WriteString(b.String()) bCpy.WriteString(b.String())
......
...@@ -25,6 +25,8 @@ func Write(message proto.Message, filename string) error { ...@@ -25,6 +25,8 @@ func Write(message proto.Message, filename string) error {
return nil return nil
} }
// Read reads a binary file (containing a marshaled protocol buffer message)
// and unmarshals it back into a protocol buffer message
func Read(filename string, message proto.Message) error { func Read(filename string, message proto.Message) error {
data, err := ioutil.ReadFile(filename) data, err := ioutil.ReadFile(filename)
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment