From 5fcea82ff60c903a02d0e5bb9849cf9566994431 Mon Sep 17 00:00:00 2001
From: Malte Bauch <malte.bauch@stud.h-da.de>
Date: Mon, 28 Sep 2020 09:55:11 +0200
Subject: [PATCH] formatting and changed from goimports to gofmt

---
 .golangci.yml              |  2 +-
 database/database.go       |  2 +-
 gosdn-cli/gosdn-cli.go     | 34 ++++++++++++++++------------------
 restconf/util/unmarshal.go |  2 +-
 4 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/.golangci.yml b/.golangci.yml
index e0a2c7a88..367a0ae21 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -9,7 +9,7 @@ linters-settings:
 linters:
   disable-all: true
   enable:
-    - goimports
+    - gofmt
     - golint
     - gocyclo
     - govet
diff --git a/database/database.go b/database/database.go
index e761b779d..3333d5529 100644
--- a/database/database.go
+++ b/database/database.go
@@ -105,7 +105,7 @@ func (d Database) StoreNodeEdgePoints(json string) {
 
 }
 
-func (d Database) StoreConnections(json string){}
+func (d Database) StoreConnections(json string) {}
 
 //setNodeNodeEdgePointsRelation creates the database relations between "nodes" and "node edge points"
 func setNodeNodeEdgePointsRelation(session neo4j.Session) {
diff --git a/gosdn-cli/gosdn-cli.go b/gosdn-cli/gosdn-cli.go
index da4cf1750..d6bcc5e34 100644
--- a/gosdn-cli/gosdn-cli.go
+++ b/gosdn-cli/gosdn-cli.go
@@ -3,13 +3,13 @@ package main
 import (
 	pb "code.fbi.h-da.de/cocsn/gosdn/cliInterface"
 	"context"
+	"flag"
 	"fmt"
 	"github.com/rivo/tview"
 	"google.golang.org/grpc"
 	"log"
 	"os"
 	"time"
-	"flag"
 )
 
 const (
@@ -29,27 +29,27 @@ var (
 type cliClientConfig struct {
 	goSDNCLIAddr4 *string
 	goSDNCLIPort4 *int
-	interactive *bool
-	goSDNCommand *string
+	interactive   *bool
+	goSDNCommand  *string
 }
 
 type commandOptions struct {
-	name string
+	name        string
 	description string
-	command func(conn *grpc.ClientConn) ()
+	command     func(conn *grpc.ClientConn)
 }
 
-var commandList = map[string] commandOptions {
-	"hello": {"hello", "test connection to goSDN controller", goSDNSayHello},
+var commandList = map[string]commandOptions{
+	"hello":    {"hello", "test connection to goSDN controller", goSDNSayHello},
 	"shutdown": {"shutdown", "request goSDN controller to shutdown", goSDNShutdown},
-	"testdb" :  {"testdb", "test all database connections", goSDNTestDB},
+	"testdb":   {"testdb", "test all database connections", goSDNTestDB},
 }
 
 /*
 	gosdn-cli allows to mode of operations:
 	- interactive: text GUI to operate goSDN
     - non-interactive: basic CLI without text GUI
- */
+*/
 
 func main() {
 	// This holds the basic configuration for gosdn-cli
@@ -64,7 +64,7 @@ func main() {
 	flag.Parse()
 
 	// Print complete command list and exit
-	if (*printCommandList == true) {
+	if *printCommandList == true {
 		for _, element := range commandList {
 			fmt.Println(element.name + "\t" + element.description)
 		}
@@ -87,11 +87,11 @@ func main() {
 	log.Println(("Connected to " + conn.Target()))
 
 	// Check for non-interactive or interactive mode
-	if(*myConfiguration.interactive == false) {
+	if *myConfiguration.interactive == false {
 		log.Println("starting in non-interactive mode")
 		// Lookup command or die
 		_, found := commandList[*myConfiguration.goSDNCommand]
-		if(found) {
+		if found {
 			// Excecute desired command
 			commandList[*myConfiguration.goSDNCommand].command(conn)
 		} else {
@@ -118,8 +118,7 @@ func main() {
 	}
 }
 
-
-func goSDNSayHello (conn *grpc.ClientConn) {
+func goSDNSayHello(conn *grpc.ClientConn) {
 
 	c := pb.NewGreeterClient(conn)
 
@@ -136,10 +135,9 @@ func goSDNSayHello (conn *grpc.ClientConn) {
 	}
 	log.Printf("Greeting: %s", r.GetMessage())
 
-
 }
 
-func goSDNShutdown (conn *grpc.ClientConn) {
+func goSDNShutdown(conn *grpc.ClientConn) {
 
 	c := pb.NewGreeterClient(conn)
 
@@ -157,6 +155,6 @@ func goSDNShutdown (conn *grpc.ClientConn) {
 	log.Printf("Greeting: %s", r.GetMessage())
 }
 
-func goSDNTestDB(conn *grpc.ClientConn){
+func goSDNTestDB(conn *grpc.ClientConn) {
 	// TODO: fill with code
-}
\ No newline at end of file
+}
diff --git a/restconf/util/unmarshal.go b/restconf/util/unmarshal.go
index b044bd09c..63437e6b2 100644
--- a/restconf/util/unmarshal.go
+++ b/restconf/util/unmarshal.go
@@ -9,7 +9,7 @@ type YANGConsumer struct {
 	Data *[]byte
 }
 
-func (yc YANGConsumer)Consume(reader io.Reader, _ interface{}) error {
+func (yc YANGConsumer) Consume(reader io.Reader, _ interface{}) error {
 	var err error = nil
 	*yc.Data, err = ioutil.ReadAll(reader)
 	return err
-- 
GitLab