From 0d8baacb719f0402b135538e37eb19f6e5916677 Mon Sep 17 00:00:00 2001 From: Martin Jackson Date: Tue, 29 Nov 2022 08:52:17 -0600 Subject: [PATCH] Declare structs Signed-off-by: Martin Jackson --- src/cmd/root.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cmd/root.go b/src/cmd/root.go index cd9a5694b..d37fefb1f 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -1,6 +1,3 @@ -//go:build linux && cgo && libsubid -// +build linux,cgo,libsubid - /* * Copyright © 2019 – 2022 Red Hat Inc. * @@ -39,7 +36,6 @@ struct subid_range get_range(struct subid_range *ranges, int i) import "C" import ( - "bufio" "errors" "fmt" "io/ioutil" @@ -89,6 +85,13 @@ type exitError struct { err error } +type subIDRange struct { + Start int + Length int +} + +type ranges []subIDRange + func (e *exitError) Error() string { if e.err != nil { return e.err.Error() @@ -418,6 +421,8 @@ func setUpLoggers() error { func validateSubIDRange(username string, isUser bool) (ranges, error) { var ret ranges + queryType := "" + if isUser { queryType = "subuid" } else { @@ -467,7 +472,7 @@ func validateSubIDRange(username string, isUser bool) (ranges, error) { ret = append(ret, newRange) logrus.Debugf("Found %s range %d for %s: start [%d] length [%d]", - querytype, + queryType, i, username, r.start,