go: re-do the entire thing

This is a mega-change, but attempting to split this up further is
probably not worth the effort.

Summary:

1. Bump up bazel, rules_go, and others.
2. Switch to new go target naming (bye bye go_default_library)
3. Move go deps to go.mod/go.sum, use make gazelle generate from that
4. Bump up Python deps a bit

And also whatever was required to actually get things to work - loads of
small useless changes.

Tested to work on NixOS and Ubuntu 20.04:

   $ bazel build //...
   $ bazel test //...

Change-Id: I8364bdaa1406b9ae4d0385a6b607f3e7989f98a9
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1583
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/dc/m6220-proxy/main.go b/dc/m6220-proxy/main.go
index f4c348b..4a63cc9 100644
--- a/dc/m6220-proxy/main.go
+++ b/dc/m6220-proxy/main.go
@@ -8,14 +8,15 @@
 	"strconv"
 	"strings"
 
-	"code.hackerspace.pl/hscloud/go/mirko"
 	"github.com/golang/glog"
 	"github.com/ziutek/telnet"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 
+	"code.hackerspace.pl/hscloud/dc/m6220-proxy/cli"
 	pb "code.hackerspace.pl/hscloud/dc/m6220-proxy/proto"
 	dpb "code.hackerspace.pl/hscloud/dc/proto"
+	"code.hackerspace.pl/hscloud/go/mirko"
 )
 
 var (
@@ -32,7 +33,7 @@
 	connectionSemaphore chan int
 }
 
-func (s *service) connect() (*cliClient, error) {
+func (s *service) connect() (*cli.Client, error) {
 	s.connectionSemaphore <- 1
 	conn, err := telnet.Dial("tcp", flagSwitchAddress)
 	if err != nil {
@@ -40,7 +41,7 @@
 		return nil, err
 	}
 
-	cli := newCliClient(conn, flagSwitchUsername, flagSwitchPassword)
+	cli := cli.NewClient(conn, flagSwitchUsername, flagSwitchPassword)
 	return cli, nil
 }
 
@@ -59,7 +60,7 @@
 	}
 	defer s.disconnect()
 
-	lines, effective, err := cli.runCommand(ctx, req.Command)
+	lines, effective, err := cli.RunCommand(ctx, req.Command)
 	if err != nil {
 		return nil, err
 	}
@@ -227,7 +228,7 @@
 	defer s.disconnect()
 	res := &dpb.GetPortsResponse{}
 
-	statusLines, _, err := cli.runCommand(ctx, "show interface status")
+	statusLines, _, err := cli.RunCommand(ctx, "show interface status")
 	if err != nil {
 		return nil, status.Error(codes.Unavailable, "could not get interface status from switch")
 	}
@@ -238,7 +239,7 @@
 	}
 
 	for _, port := range res.Ports {
-		configLines, _, err := cli.runCommand(ctx, "show run interface "+port.Name)
+		configLines, _, err := cli.RunCommand(ctx, "show run interface "+port.Name)
 		if err != nil {
 			return nil, status.Error(codes.Unavailable, "could not get interface config from switch")
 		}