Skip to content

Commit

Permalink
many: fix failing golangci checks
Browse files Browse the repository at this point in the history
* Group 3rd party imports
* Remove unused vars
* Move var only used in tests into test
* Add 'nolint' to ignore warning on unused iotas (might've been
left to improve readability).
  • Loading branch information
miguelpires committed Feb 9, 2022
1 parent 09480eb commit 615da77
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions asserts/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
type fetchProgress int

const (
//nolint:deadcode
fetchNotSeen fetchProgress = iota
fetchRetrieved
fetchSaved
Expand Down
1 change: 1 addition & 0 deletions cmd/snap-update-ns/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
// SquashfsMagic is the equivalent of SQUASHFS_MAGIC
SquashfsMagic = 0x73717368
// Ext4Magic is the equivalent of EXT4_SUPER_MAGIC
//nolint:deadcode
Ext4Magic = 0xef53
// TmpfsMagic is the equivalent of TMPFS_MAGIC
TmpfsMagic = 0x01021994
Expand Down
2 changes: 0 additions & 2 deletions cmd/snap/cmd_auto_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ import (

const autoImportsName = "auto-import.assert"

var mountInfoPath = "/proc/self/mountinfo"

func autoImportCandidates() ([]string, error) {
var cands []string

Expand Down
2 changes: 0 additions & 2 deletions dbusutil/netplantest/netplantest.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const (
netplanInterface = "io.netplan.Netplan"

netplanConfigInterface = "io.netplan.Netplan.Config"

introspectInterface = "org.freedesktop.DBus.Introspectable"
)

type NetplanServer struct {
Expand Down
1 change: 0 additions & 1 deletion desktop/notification/fdo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"time"

"github.com/godbus/dbus"

. "gopkg.in/check.v1"

"github.com/snapcore/snapd/desktop/notification"
Expand Down
3 changes: 1 addition & 2 deletions desktop/notification/gtk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
package notification_test

import (
. "gopkg.in/check.v1"

"github.com/godbus/dbus"
. "gopkg.in/check.v1"

"github.com/snapcore/snapd/desktop/notification"
"github.com/snapcore/snapd/desktop/notification/notificationtest"
Expand Down
2 changes: 1 addition & 1 deletion desktop/notification/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ package notification_test
import (
"fmt"

"github.com/godbus/dbus"
. "gopkg.in/check.v1"

"github.com/godbus/dbus"
"github.com/snapcore/snapd/desktop/notification"
"github.com/snapcore/snapd/testutil"
)
Expand Down
2 changes: 0 additions & 2 deletions osutil/faultinject_dummy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import (

type testhelperDummyFaultInjectionSuite struct {
testutil.BaseTest

sysroot string
}

var _ = Suite(&testhelperDummyFaultInjectionSuite{})
Expand Down
3 changes: 1 addition & 2 deletions overlord/configstate/configcore/netplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ import (
"strings"
"time"

"gopkg.in/yaml.v3"

"github.com/godbus/dbus"
"gopkg.in/yaml.v3"

"github.com/snapcore/snapd/dbusutil"
"github.com/snapcore/snapd/logger"
Expand Down
1 change: 0 additions & 1 deletion overlord/configstate/configcore/netplan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"time"

"github.com/godbus/dbus"

. "gopkg.in/check.v1"

"github.com/snapcore/snapd/dbusutil"
Expand Down
1 change: 1 addition & 0 deletions spdx/licenses.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package spdx
// Version: 3.11 2020-11-25
//
// jq < json/licenses.json '.licenses | .[] | select(.isOsiApproved == true) | .licenseId' | sort | sed -e 's/$/,/'
//nolint:deadcode,unused
var osi = []string{
"0BSD",
"AAL",
Expand Down
1 change: 1 addition & 0 deletions store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ var (
type deviceAuthNeed int

const (
//nolint:deadcode
deviceAuthPreferred deviceAuthNeed = iota
deviceAuthCustomStoreOnly
)
Expand Down
1 change: 1 addition & 0 deletions strutil/shlex/shlex.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const (

// Classes of rune token
const (
//nolint:deadcode
unknownRuneClass runeTokenClass = iota
spaceRuneClass
escapingQuoteRuneClass
Expand Down

0 comments on commit 615da77

Please sign in to comment.