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
No related branches found
No related tags found
2 merge requests!120Resolve "Code Quality",!90Develop
......@@ -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
POSSIBILITY OF SUCH DAMAGE.
*/
package cmd
import (
......@@ -39,7 +40,7 @@ import (
var utilCmd = &cobra.Command{
Use: "util",
Short: "multiple ygot utils - not yet implemented",
Long: ``,
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
return errors.New("not implemented")
},
......
......@@ -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
POSSIBILITY OF SUCH DAMAGE.
*/
package cmd
import (
......@@ -40,7 +41,7 @@ import (
var ygotCmd = &cobra.Command{
Use: "ygot",
Short: "multiple ygot utils - not yet implemented",
Long: ``,
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
return errors.New("not implemented")
},
......
......@@ -273,8 +273,8 @@ func TestGnmi_SubscribeIntegration(t *testing.T) {
go func() {
err = g.Subscribe(ctx)
if (err != nil) != tt.wantErr {
if !tt.wantErr{
if err.Error() != "rpc error: code = Canceled desc = context canceled"{
if !tt.wantErr {
if err.Error() != "rpc error: code = Canceled desc = context canceled" {
t.Errorf("Subscribe() error = %v, wantErr %v", err, tt.wantErr)
}
}
......
......@@ -35,8 +35,8 @@ func TestOpenConfig_Id(t *testing.T) {
{
name: "default",
fields: fields{
schema: nil,
id: ocUUID,
schema: nil,
id: ocUUID,
},
want: ocUUID,
},
......@@ -44,8 +44,8 @@ func TestOpenConfig_Id(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{
schema: tt.fields.schema,
id: tt.fields.id,
schema: tt.fields.schema,
id: tt.fields.id,
}
if got := oc.Id(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Id() = %v, want %v", got, tt.want)
......@@ -56,8 +56,8 @@ func TestOpenConfig_Id(t *testing.T) {
func TestOpenConfig_SbiIdentifier(t *testing.T) {
type fields struct {
schema *ytypes.Schema
id uuid.UUID
schema *ytypes.Schema
id uuid.UUID
}
tests := []struct {
name string
......@@ -69,8 +69,8 @@ func TestOpenConfig_SbiIdentifier(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{
schema: tt.fields.schema,
id: tt.fields.id,
schema: tt.fields.schema,
id: tt.fields.id,
}
if got := oc.SbiIdentifier(); got != tt.want {
t.Errorf("SbiIdentifier() = %v, want %v", got, tt.want)
......@@ -85,8 +85,8 @@ func TestOpenConfig_Schema(t *testing.T) {
t.Error(err)
}
type fields struct {
schema *ytypes.Schema
id uuid.UUID
schema *ytypes.Schema
id uuid.UUID
}
tests := []struct {
name string
......@@ -98,8 +98,8 @@ func TestOpenConfig_Schema(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{
schema: tt.fields.schema,
id: tt.fields.id,
schema: tt.fields.schema,
id: tt.fields.id,
}
got := oc.Schema().SchemaTree
if !reflect.DeepEqual(got, tt.want.SchemaTree) {
......
......@@ -8,9 +8,9 @@ import (
"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 {
Children []*Element
Name 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) {
if b.Len() == 0 {
b.WriteString(DELIM)
b.WriteString(delim)
}
b.WriteString(v.Name)
if v.Children != nil {
b.WriteString(DELIM)
b.WriteString(delim)
for _, c := range v.Children {
var bCpy strings.Builder
bCpy.WriteString(b.String())
......
......@@ -25,6 +25,8 @@ func Write(message proto.Message, filename string) error {
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 {
data, err := ioutil.ReadFile(filename)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment