[lxc-devel] [lxd/master] golint fixes

stgraber on Github lxc-bot at linuxcontainers.org
Sun Feb 16 01:40:17 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200215/ba76e6de/attachment.bin>
-------------- next part --------------
From 28bd81abed046fe8d885788508ebcf0e1a27dde7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 19:32:42 -0500
Subject: [PATCH 1/7] lxc-to-lxd: golint fix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc-to-lxd/main_migrate.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxc-to-lxd/main_migrate.go b/lxc-to-lxd/main_migrate.go
index f0848dc8be..4542f0efb3 100644
--- a/lxc-to-lxd/main_migrate.go
+++ b/lxc-to-lxd/main_migrate.go
@@ -395,12 +395,12 @@ func convertContainer(d lxd.ContainerServer, container *lxc.Container, storage s
 		arch = value[0]
 	}
 
-	archId, err := osarch.ArchitectureId(arch)
+	archID, err := osarch.ArchitectureId(arch)
 	if err != nil {
 		return err
 	}
 
-	req.Architecture, err = osarch.ArchitectureName(archId)
+	req.Architecture, err = osarch.ArchitectureName(archID)
 	if err != nil {
 		return err
 	}

From 2179980dad438ea3a28df02c51f5f61577722acd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 19:33:02 -0500
Subject: [PATCH 2/7] lxd/cluster: golint fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/cluster/raft/bolt.go     | 17 ++++++++++-------
 lxd/cluster/raft/log.go      |  4 ++--
 lxd/cluster/raft/snapshot.go |  6 +++++-
 lxd/cluster/recover.go       |  2 ++
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/lxd/cluster/raft/bolt.go b/lxd/cluster/raft/bolt.go
index a385114050..b6176cd415 100644
--- a/lxd/cluster/raft/bolt.go
+++ b/lxd/cluster/raft/bolt.go
@@ -20,9 +20,10 @@ var (
 	dbLogs = []byte("logs")
 	dbConf = []byte("conf")
 
-	// An error indicating a given key does not exist
+	// ErrKeyNotFound indicates that a given key does not exist
 	ErrKeyNotFound = errors.New("not found")
 
+	// ErrLogNotFound indicates that the raft log was not found
 	ErrLogNotFound = errors.New("log not found")
 )
 
@@ -123,11 +124,12 @@ func (b *BoltStore) FirstIndex() (uint64, error) {
 	defer tx.Rollback()
 
 	curs := tx.Bucket(dbLogs).Cursor()
-	if first, _ := curs.First(); first == nil {
+	first, _ := curs.First()
+	if first == nil {
 		return 0, nil
-	} else {
-		return bytesToUint64(first), nil
 	}
+
+	return bytesToUint64(first), nil
 }
 
 // LastIndex returns the last known index from the Raft log.
@@ -139,11 +141,12 @@ func (b *BoltStore) LastIndex() (uint64, error) {
 	defer tx.Rollback()
 
 	curs := tx.Bucket(dbLogs).Cursor()
-	if last, _ := curs.Last(); last == nil {
+	last, _ := curs.Last()
+	if last == nil {
 		return 0, nil
-	} else {
-		return bytesToUint64(last), nil
 	}
+
+	return bytesToUint64(last), nil
 }
 
 // GetLog is used to retrieve a log from BoltDB at a given index.
diff --git a/lxd/cluster/raft/log.go b/lxd/cluster/raft/log.go
index 4ade38ecc1..1056a8e35a 100644
--- a/lxd/cluster/raft/log.go
+++ b/lxd/cluster/raft/log.go
@@ -10,12 +10,12 @@ const (
 	// LogNoop is used to assert leadership.
 	LogNoop
 
-	// LogAddPeer is used to add a new peer. This should only be used with
+	// LogAddPeerDeprecated is used to add a new peer. This should only be used with
 	// older protocol versions designed to be compatible with unversioned
 	// Raft servers. See comments in config.go for details.
 	LogAddPeerDeprecated
 
-	// LogRemovePeer is used to remove an existing peer. This should only be
+	// LogRemovePeerDeprecated is used to remove an existing peer. This should only be
 	// used with older protocol versions designed to be compatible with
 	// unversioned Raft servers. See comments in config.go for details.
 	LogRemovePeerDeprecated
diff --git a/lxd/cluster/raft/snapshot.go b/lxd/cluster/raft/snapshot.go
index 72ba6b8420..56e3234d74 100644
--- a/lxd/cluster/raft/snapshot.go
+++ b/lxd/cluster/raft/snapshot.go
@@ -4,11 +4,15 @@ import (
 	"io"
 )
 
+// SnapshotVersion represents the version of the snapshot metadata
 type SnapshotVersion int
 
 const (
+	// SnapshotVersionMin is the minimum snapshot metadata version
 	SnapshotVersionMin SnapshotVersion = 0
-	SnapshotVersionMax                 = 1
+
+	// SnapshotVersionMax is the maximum snapshot metadata version
+	SnapshotVersionMax = 1
 )
 
 // SnapshotMeta is for metadata of a snapshot.
diff --git a/lxd/cluster/recover.go b/lxd/cluster/recover.go
index 874357476b..780feb5a1c 100644
--- a/lxd/cluster/recover.go
+++ b/lxd/cluster/recover.go
@@ -10,6 +10,7 @@ import (
 	"github.com/pkg/errors"
 )
 
+// ListDatabaseNodes returns a list of database node names.
 func ListDatabaseNodes(database *db.Node) ([]string, error) {
 	nodes := []db.RaftNode{}
 	err := database.Transaction(func(tx *db.NodeTx) error {
@@ -30,6 +31,7 @@ func ListDatabaseNodes(database *db.Node) ([]string, error) {
 	return addresses, nil
 }
 
+// Recover attempts data recovery on the cluster database.
 func Recover(database *db.Node) error {
 	// Figure out if we actually act as dqlite node.
 	var info *db.RaftNode

From 6048bd6401b73739c8166374061f9f6e4473efe6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 19:33:47 -0500
Subject: [PATCH 3/7] lxd/migration: golint fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/migration/utils.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lxd/migration/utils.go b/lxd/migration/utils.go
index f7843476b8..92265c2ace 100644
--- a/lxd/migration/utils.go
+++ b/lxd/migration/utils.go
@@ -1,11 +1,11 @@
 package migration
 
+// GetRsyncFeaturesSlice returns a slice of strings representing the supported RSYNC features
 func (m *MigrationHeader) GetRsyncFeaturesSlice() []string {
 	features := []string{}
 	if m == nil {
 		return features
 	}
-
 	if m.RsyncFeatures != nil {
 		if m.RsyncFeatures.Xattrs != nil && *m.RsyncFeatures.Xattrs == true {
 			features = append(features, "xattrs")
@@ -27,6 +27,7 @@ func (m *MigrationHeader) GetRsyncFeaturesSlice() []string {
 	return features
 }
 
+// GetZfsFeaturesSlice returns a slice of strings representing the supported ZFS features
 func (m *MigrationHeader) GetZfsFeaturesSlice() []string {
 	features := []string{}
 	if m == nil {

From 97861dc143b5d11e47a10a7e72e10a2e800274e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 19:34:04 -0500
Subject: [PATCH 4/7] shared/containerwriter: golint fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/containerwriter/container_tar_writer.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/shared/containerwriter/container_tar_writer.go b/shared/containerwriter/container_tar_writer.go
index 23cecc5b2f..7ebbf43546 100644
--- a/shared/containerwriter/container_tar_writer.go
+++ b/shared/containerwriter/container_tar_writer.go
@@ -11,12 +11,15 @@ import (
 	"github.com/lxc/lxd/shared/idmap"
 )
 
+// ContainerTarWriter provides a TarWriter implementation that handles
+// ID shifting and hardlink tracking for containers
 type ContainerTarWriter struct {
 	tarWriter *tar.Writer
 	idmapSet  *idmap.IdmapSet
 	linkMap   map[uint64]string
 }
 
+// NewContainerTarWriter returns a ContainerTarWriter for the provided target Writer and id map
 func NewContainerTarWriter(writer io.Writer, idmapSet *idmap.IdmapSet) *ContainerTarWriter {
 	ctw := new(ContainerTarWriter)
 	ctw.tarWriter = tar.NewWriter(writer)
@@ -25,6 +28,7 @@ func NewContainerTarWriter(writer io.Writer, idmapSet *idmap.IdmapSet) *Containe
 	return ctw
 }
 
+// WriteFile adds a file to the tarball
 func (ctw *ContainerTarWriter) WriteFile(offset int, path string, fi os.FileInfo) error {
 	var err error
 	var major, minor uint32
@@ -114,6 +118,7 @@ func (ctw *ContainerTarWriter) WriteFile(offset int, path string, fi os.FileInfo
 	return nil
 }
 
+// Close finishes writing the tarball
 func (ctw *ContainerTarWriter) Close() error {
 	err := ctw.tarWriter.Close()
 	if err != nil {

From 310eaccad987b89b77a13bd2a4ef01b2de21c027 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 19:54:53 -0500
Subject: [PATCH 5/7] shared/generate: golint fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/generate/db.go       |  4 ++--
 shared/generate/db/lex.go   | 10 +++++-----
 shared/generate/db/parse.go |  1 +
 shared/generate/db/stmt.go  | 30 +++++++++++++++---------------
 4 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/shared/generate/db.go b/shared/generate/db.go
index aea8cf1597..6775c73a1d 100644
--- a/shared/generate/db.go
+++ b/shared/generate/db.go
@@ -86,7 +86,7 @@ func newDbMapperStmt() *cobra.Command {
 			kind := args[0]
 
 			if entity == "" {
-				return fmt.Errorf("No database entity given.")
+				return fmt.Errorf("No database entity given")
 			}
 
 			config, err := parseParams(args[1:])
@@ -126,7 +126,7 @@ func newDbMapperMethod() *cobra.Command {
 			kind := args[0]
 
 			if entity == "" {
-				return fmt.Errorf("No database entity given.")
+				return fmt.Errorf("No database entity given")
 			}
 
 			config, err := parseParams(args[1:])
diff --git a/shared/generate/db/lex.go b/shared/generate/db/lex.go
index 7133de836c..b2aa81dc3c 100644
--- a/shared/generate/db/lex.go
+++ b/shared/generate/db/lex.go
@@ -9,13 +9,13 @@ import (
 
 // Return the table name for the given database entity.
 func entityTable(entity string) string {
-	entity_parts := strings.Split(lex.Snake(entity), "_")
-	table_parts := make([]string, len(entity_parts))
-	for i, part := range entity_parts {
-		table_parts[i] = lex.Plural(part)
+	entityParts := strings.Split(lex.Snake(entity), "_")
+	tableParts := make([]string, len(entityParts))
+	for i, part := range entityParts {
+		tableParts[i] = lex.Plural(part)
 	}
 
-	return strings.Join(table_parts, "_")
+	return strings.Join(tableParts, "_")
 }
 
 // Return Go type of the given database entity.
diff --git a/shared/generate/db/parse.go b/shared/generate/db/parse.go
index b785c75bcf..d9f34346de 100644
--- a/shared/generate/db/parse.go
+++ b/shared/generate/db/parse.go
@@ -80,6 +80,7 @@ func RefFilters(pkg *ast.Package, entity string, ref string) [][]string {
 	return filters
 }
 
+// Criteria returns a list of criteria
 func Criteria(pkg *ast.Package, entity string) ([]string, error) {
 	name := fmt.Sprintf("%sFilter", lex.Camel(entity))
 	str := findStruct(pkg.Scope, name)
diff --git a/shared/generate/db/stmt.go b/shared/generate/db/stmt.go
index 119a429159..4a84bba209 100644
--- a/shared/generate/db/stmt.go
+++ b/shared/generate/db/stmt.go
@@ -353,15 +353,15 @@ func (s *Stmt) create(buf *file.Buffer) error {
 			table := entityTable(ref)
 			params[i] = fmt.Sprintf("(SELECT %s.id FROM %s", table, table)
 			for _, other := range via[ref] {
-				other_ref := lex.Snake(other.Name)
-				other_table := entityTable(other_ref)
-				params[i] += fmt.Sprintf(" JOIN %s ON %s.id = %s.%s_id", other_table, other_table, table, other_ref)
+				otherRef := lex.Snake(other.Name)
+				otherTable := entityTable(otherRef)
+				params[i] += fmt.Sprintf(" JOIN %s ON %s.id = %s.%s_id", otherTable, otherTable, table, otherRef)
 			}
 			params[i] += fmt.Sprintf(" WHERE")
 			for _, other := range via[ref] {
-				other_ref := lex.Snake(other.Name)
-				other_table := entityTable(other_ref)
-				params[i] += fmt.Sprintf(" %s.name = ? AND", other_table)
+				otherRef := lex.Snake(other.Name)
+				otherTable := entityTable(otherRef)
+				params[i] += fmt.Sprintf(" %s.name = ? AND", otherTable)
 			}
 			params[i] += fmt.Sprintf(" %s.name = ?)", table)
 		} else {
@@ -568,20 +568,20 @@ func naturalKeyWhere(mapping *Mapping) string {
 	for i, field := range fields {
 		if field.IsScalar() {
 			ref := lex.Snake(field.Name)
-			ref_table := entityTable(ref)
-			subSelect := fmt.Sprintf("SELECT %s.id FROM %s", ref_table, ref_table)
+			refTable := entityTable(ref)
+			subSelect := fmt.Sprintf("SELECT %s.id FROM %s", refTable, refTable)
 			for _, other := range via[ref] {
-				other_ref := lex.Snake(other.Name)
-				other_table := entityTable(other_ref)
-				subSelect += fmt.Sprintf(" JOIN %s ON %s.id = %s.%s_id", other_table, other_table, ref_table, other_ref)
+				otherRef := lex.Snake(other.Name)
+				otherTable := entityTable(otherRef)
+				subSelect += fmt.Sprintf(" JOIN %s ON %s.id = %s.%s_id", otherTable, otherTable, refTable, otherRef)
 			}
 			subSelect += fmt.Sprintf(" WHERE")
 			for _, other := range via[ref] {
-				other_ref := lex.Snake(other.Name)
-				other_table := entityTable(other_ref)
-				subSelect += fmt.Sprintf(" %s.name = ? AND", other_table)
+				otherRef := lex.Snake(other.Name)
+				otherTable := entityTable(otherRef)
+				subSelect += fmt.Sprintf(" %s.name = ? AND", otherTable)
 			}
-			subSelect += fmt.Sprintf(" %s.name = ?", ref_table)
+			subSelect += fmt.Sprintf(" %s.name = ?", refTable)
 			where[i] = fmt.Sprintf("%s_id = (%s)", ref, subSelect)
 		} else {
 

From 2d6302c7a4c05d6aac1d838387d1c5872f8362c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 20:30:06 -0500
Subject: [PATCH 6/7] shared/netutils: golint fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/netutils/network_linux.go | 37 ++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/shared/netutils/network_linux.go b/shared/netutils/network_linux.go
index cbea0423b3..0dc7bb72b0 100644
--- a/shared/netutils/network_linux.go
+++ b/shared/netutils/network_linux.go
@@ -24,8 +24,9 @@ import (
 */
 import "C"
 
+// NetnsGetifaddrs returns a map of InstanceStateNetwork for a particular process.
 func NetnsGetifaddrs(initPID int32) (map[string]api.InstanceStateNetwork, error) {
-	var netnsid_aware C.bool
+	var netnsidAware C.bool
 	var ifaddrs *C.struct_netns_ifaddrs
 	var netnsID C.__s32
 
@@ -44,13 +45,13 @@ func NetnsGetifaddrs(initPID int32) (map[string]api.InstanceStateNetwork, error)
 		netnsID = -1
 	}
 
-	ret := C.netns_getifaddrs(&ifaddrs, netnsID, &netnsid_aware)
+	ret := C.netns_getifaddrs(&ifaddrs, netnsID, &netnsidAware)
 	if ret < 0 {
 		return nil, fmt.Errorf("Failed to retrieve network interfaces and addresses")
 	}
 	defer C.netns_freeifaddrs(ifaddrs)
 
-	if netnsID >= 0 && !netnsid_aware {
+	if netnsID >= 0 && !netnsidAware {
 		return nil, fmt.Errorf("Netlink requests are not fully network namespace id aware")
 	}
 
@@ -105,13 +106,13 @@ func NetnsGetifaddrs(initPID int32) (map[string]api.InstanceStateNetwork, error)
 				family = "inet6"
 			}
 
-			addr_ptr := C.get_addr_ptr(addr.ifa_addr)
-			if addr_ptr == nil {
+			addrPtr := C.get_addr_ptr(addr.ifa_addr)
+			if addrPtr == nil {
 				return nil, fmt.Errorf("Failed to retrieve valid address pointer")
 			}
 
-			address_str := C.inet_ntop(C.int(addr.ifa_addr.sa_family), addr_ptr, &address[0], C.INET6_ADDRSTRLEN)
-			if address_str == nil {
+			addressStr := C.inet_ntop(C.int(addr.ifa_addr.sa_family), addrPtr, &address[0], C.INET6_ADDRSTRLEN)
+			if addressStr == nil {
 				return nil, fmt.Errorf("Failed to retrieve address string")
 			}
 
@@ -119,7 +120,7 @@ func NetnsGetifaddrs(initPID int32) (map[string]api.InstanceStateNetwork, error)
 				addNetwork.Addresses = []api.InstanceStateNetworkAddress{}
 			}
 
-			goAddrString := C.GoString(address_str)
+			goAddrString := C.GoString(addressStr)
 			scope := "global"
 			if strings.HasPrefix(goAddrString, "127") {
 				scope = "local"
@@ -171,6 +172,7 @@ func NetnsGetifaddrs(initPID int32) (map[string]api.InstanceStateNetwork, error)
 	return networks, nil
 }
 
+// WebsocketExecMirror mirrors a websocket connection with a set of Writer/Reader.
 func WebsocketExecMirror(conn *websocket.Conn, w io.WriteCloser, r io.ReadCloser, exited chan bool, fd int) (chan bool, chan bool) {
 	readDone := make(chan bool, 1)
 	writeDone := make(chan bool, 1)
@@ -208,10 +210,11 @@ func WebsocketExecMirror(conn *websocket.Conn, w io.WriteCloser, r io.ReadCloser
 	return readDone, writeDone
 }
 
+// AbstractUnixSendFd sends a Unix file descriptor over a Unix socket.
 func AbstractUnixSendFd(sockFD int, sendFD int) error {
 	fd := C.int(sendFD)
-	sk_fd := C.int(sockFD)
-	ret := C.lxc_abstract_unix_send_fds(sk_fd, &fd, C.int(1), nil, C.size_t(0))
+	skFd := C.int(sockFD)
+	ret := C.lxc_abstract_unix_send_fds(skFd, &fd, C.int(1), nil, C.size_t(0))
 	if ret < 0 {
 		return fmt.Errorf("Failed to send file descriptor via abstract unix socket")
 	}
@@ -219,10 +222,11 @@ func AbstractUnixSendFd(sockFD int, sendFD int) error {
 	return nil
 }
 
+// AbstractUnixReceiveFd receives a Unix file descriptor from a Unix socket.
 func AbstractUnixReceiveFd(sockFD int) (*os.File, error) {
 	fd := C.int(-1)
-	sk_fd := C.int(sockFD)
-	ret := C.lxc_abstract_unix_recv_fds(sk_fd, &fd, C.int(1), nil, C.size_t(0))
+	skFd := C.int(sockFD)
+	ret := C.lxc_abstract_unix_recv_fds(skFd, &fd, C.int(1), nil, C.size_t(0))
 	if ret < 0 {
 		return nil, fmt.Errorf("Failed to receive file descriptor via abstract unix socket")
 	}
@@ -231,10 +235,11 @@ func AbstractUnixReceiveFd(sockFD int) (*os.File, error) {
 	return file, nil
 }
 
-func AbstractUnixReceiveFdData(sockFD int, num_fds int, iov unsafe.Pointer, iovLen int32) (uint64, []C.int, error) {
-	cfd := make([]C.int, num_fds)
-	sk_fd := C.int(sockFD)
-	ret, errno := C.lxc_abstract_unix_recv_fds_iov(sk_fd, (*C.int)(&cfd[0]), C.int(num_fds), (*C.struct_iovec)(iov), C.size_t(iovLen))
+// AbstractUnixReceiveFdData is a low level function to receive a file descriptor over a unix socket.
+func AbstractUnixReceiveFdData(sockFD int, numFds int, iov unsafe.Pointer, iovLen int32) (uint64, []C.int, error) {
+	cfd := make([]C.int, numFds)
+	skFd := C.int(sockFD)
+	ret, errno := C.lxc_abstract_unix_recv_fds_iov(skFd, (*C.int)(&cfd[0]), C.int(numFds), (*C.struct_iovec)(iov), C.size_t(iovLen))
 	if ret < 0 {
 		return 0, []C.int{-C.EBADF}, fmt.Errorf("Failed to receive file descriptor via abstract unix socket: errno=%d", errno)
 	}

From df83f891505f1005e6e1ece2e3ad401ffc9a653e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 20:37:20 -0500
Subject: [PATCH 7/7] tests: Update golint list
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 test/suites/static_analysis.sh | 124 ++++++++++++++++++---------------
 1 file changed, 66 insertions(+), 58 deletions(-)

diff --git a/test/suites/static_analysis.sh b/test/suites/static_analysis.sh
index e7eeaae976..ff95fb4057 100644
--- a/test/suites/static_analysis.sh
+++ b/test/suites/static_analysis.sh
@@ -59,69 +59,77 @@ test_static_analysis() {
 
     ## golint
     if which golint >/dev/null 2>&1; then
-      golint -set_exit_status client/
-
-      golint -set_exit_status fuidshift/
-
-      golint -set_exit_status lxc/
-      golint -set_exit_status lxc/config/
-      golint -set_exit_status lxc/utils/
-
-      golint -set_exit_status lxd-agent
-
-      golint -set_exit_status lxd-benchmark
-      golint -set_exit_status lxd-benchmark/benchmark
-
-      golint -set_exit_status lxd-p2c
-
-      golint -set_exit_status lxd/backup
-      golint -set_exit_status lxd/cgroup
-      golint -set_exit_status lxd/config
-      golint -set_exit_status lxd/db
-      golint -set_exit_status lxd/db/node
-      golint -set_exit_status lxd/db/query
-      golint -set_exit_status lxd/db/schema
-      golint -set_exit_status lxd/endpoints
-      golint -set_exit_status lxd/events
-      golint -set_exit_status lxd/maas
-      #golint -set_exit_status lxd/migration
-      golint -set_exit_status lxd/node
-      golint -set_exit_status lxd/operations
-      golint -set_exit_status lxd/response
-      golint -set_exit_status lxd/state
-      golint -set_exit_status lxd/storage/...
-      golint -set_exit_status lxd/sys
-      golint -set_exit_status lxd/task
-      golint -set_exit_status lxd/template
-      golint -set_exit_status lxd/util
+      golint -set_exit_status client/...
+
+      golint -set_exit_status fuidshift/...
+
+      golint -set_exit_status lxc/...
+
+      golint -set_exit_status lxd-agent/...
+
+      golint -set_exit_status lxd-benchmark/...
+
+      golint -set_exit_status lxd-p2c/...
+
+      golint -set_exit_status lxd/apparmor/...
+      golint -set_exit_status lxd/backup/...
+      golint -set_exit_status lxd/cgroup/...
+      golint -set_exit_status lxd/cluster/...
+      golint -set_exit_status lxd/config/...
+      golint -set_exit_status lxd/daemon/...
+      golint -set_exit_status lxd/db/...
       golint -set_exit_status lxd/device/...
       golint -set_exit_status lxd/dnsmasq/...
+      golint -set_exit_status lxd/endpoints/...
+      golint -set_exit_status lxd/events/...
+      golint -set_exit_status lxd/filter/...
       golint -set_exit_status lxd/firewall/...
       golint -set_exit_status lxd/instance/...
-      golint -set_exit_status lxd/ucred/...
-      golint -set_exit_status lxd/seccomp/...
-      golint -set_exit_status lxd/apparmor/...
-      golint -set_exit_status lxd/daemon/...
-      golint -set_exit_status lxd/rsync/...
+      golint -set_exit_status lxd/maas/...
+      golint -set_exit_status lxd/migration/...
       golint -set_exit_status lxd/network/...
-
-      golint -set_exit_status shared/api/
-      golint -set_exit_status shared/cancel/
-      golint -set_exit_status shared/cmd/
-      golint -set_exit_status shared/eagain/
-      golint -set_exit_status shared/i18n/
-      golint -set_exit_status shared/ioprogress/
-      golint -set_exit_status shared/log15/stack
-      golint -set_exit_status shared/logger/
-      golint -set_exit_status shared/logging/
-      golint -set_exit_status shared/simplestreams/
-      golint -set_exit_status shared/subprocess/
-      golint -set_exit_status shared/subtest/
-      golint -set_exit_status shared/termios/
-      golint -set_exit_status shared/version/
-
-      golint -set_exit_status test/deps/
-      golint -set_exit_status test/macaroon-identity
+      golint -set_exit_status lxd/node/...
+      golint -set_exit_status lxd/operations/...
+      golint -set_exit_status lxd/project/...
+      golint -set_exit_status lxd/rbac/...
+      golint -set_exit_status lxd/resources/...
+      golint -set_exit_status lxd/response/...
+      golint -set_exit_status lxd/revert/...
+      golint -set_exit_status lxd/rsync/...
+      golint -set_exit_status lxd/seccomp/...
+      golint -set_exit_status lxd/state/...
+      golint -set_exit_status lxd/storage/...
+      golint -set_exit_status lxd/sys/...
+      golint -set_exit_status lxd/task/...
+      golint -set_exit_status lxd/template/...
+      golint -set_exit_status lxd/ucred/...
+      golint -set_exit_status lxd/util/...
+      golint -set_exit_status lxd/vsock/...
+
+      golint -set_exit_status shared/api/...
+      golint -set_exit_status shared/cancel/...
+      golint -set_exit_status shared/cmd/...
+      golint -set_exit_status shared/containerwriter/...
+      golint -set_exit_status shared/dnsutil/...
+      golint -set_exit_status shared/eagain/...
+      golint -set_exit_status shared/generate/...
+      golint -set_exit_status shared/i18n/...
+#      golint -set_exit_status shared/idmap/...
+      golint -set_exit_status shared/ioprogress/...
+#      golint -set_exit_status shared/log15/...
+      golint -set_exit_status shared/logger/...
+      golint -set_exit_status shared/logging/...
+      golint -set_exit_status shared/netutils/...
+#      golint -set_exit_status shared/osarch/...
+      golint -set_exit_status shared/simplestreams/...
+      golint -set_exit_status shared/subprocess/...
+      golint -set_exit_status shared/subtest/...
+      golint -set_exit_status shared/termios/...
+      golint -set_exit_status shared/units/...
+      golint -set_exit_status shared/version/...
+
+      golint -set_exit_status test/deps/...
+      golint -set_exit_status test/macaroon-identity/...
     fi
 
     ## deadcode


More information about the lxc-devel mailing list