Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ linters:
- mirror
- misspell
- nilnesserr
- nolintlint
- nosprintfhostport
- perfsprint
- prealloc
Expand Down
2 changes: 1 addition & 1 deletion common/libimage/corrupted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestCorruptedLayers(t *testing.T) {
// Now write back the layers without the first layer!
data, err = json.Marshal(layers[1:])
require.NoError(t, err, "unmarshaling layers.json")
err = ioutils.AtomicWriteFile(indexPath, data, 0o600) // nolint
err = ioutils.AtomicWriteFile(indexPath, data, 0o600)
require.NoError(t, err, "writing back layers.json")

err = image.reload() // clear the cached data
Expand Down
2 changes: 1 addition & 1 deletion common/libimage/image_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ImageConfig struct {
// * LABEL
// * STOPSIGNAL
// * ONBUILD.
func ImageConfigFromChanges(changes []string) (*ImageConfig, error) { // nolint:gocyclo
func ImageConfigFromChanges(changes []string) (*ImageConfig, error) {
config := &ImageConfig{}

for _, change := range changes {
Expand Down
3 changes: 1 addition & 2 deletions common/libimage/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ func (r *Runtime) Load(ctx context.Context, path string, options *LoadOptions) (
}

// Give a decent error message if nothing above worked.
// we want the colon here for the multiline error
//nolint:revive,staticcheck
//nolint:staticcheck // We want the colon here for the multiline error.
loadError := errors.New("payload does not match any of the supported image formats:")
for _, err := range loadErrors {
loadError = fmt.Errorf("%v\n * %v", loadError, err)
Expand Down
2 changes: 1 addition & 1 deletion common/libimage/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@
// then use that list's SaveToImage() method to save a modified version of the
// list to that image record use this lock to avoid accidentally wiping out
// changes that another process is also attempting to make.
func LockerForImage(store storage.Store, image string) (lockfile.Locker, error) { // nolint:staticcheck
func LockerForImage(store storage.Store, image string) (lockfile.Locker, error) { //nolint:staticcheck // suppress "lockfile.Locker is deprecated".

Check failure on line 960 in common/libimage/manifests/manifests.go

View workflow job for this annotation

GitHub Actions / lint

directive `//nolint:staticcheck // suppress "lockfile.Locker is deprecated".` is unused for linter "staticcheck" (nolintlint)
img, err := store.Image(image)
if err != nil {
return nil, fmt.Errorf("locating image %q for locating lock: %w", image, err)
Expand Down
2 changes: 1 addition & 1 deletion common/libnetwork/netavark/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ var _ = Describe("run netavark", func() {
netNSContainer2, err := netns.NewNS()
Expect(err).ToNot(HaveOccurred())
defer netns.UnmountNS(netNSContainer2.Path()) //nolint:errcheck
defer netNSContainer2.Close() //nolint:errcheck
defer netNSContainer2.Close()

res, err = libpodNet.Setup(netNSContainer2.Path(), setupOpts2)
Expect(err).ToNot(HaveOccurred())
Expand Down
4 changes: 0 additions & 4 deletions common/libnetwork/network/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ const (
// NetworkBackend returns the network backend name and interface.
// It returns the netavark backend. If no backend is set in the config,
// it defaults to netavark. Any other backend value is an error.
//
// revive does not like the name because the package is already called network
//
//nolint:revive
func NetworkBackend(store storage.Store, conf *config.Config, syslog bool) (types.NetworkBackend, types.ContainerNetwork, error) {
backend := types.NetworkBackend(conf.Network.NetworkBackend)
if backend != "" && backend != types.Netavark {
Expand Down
6 changes: 1 addition & 5 deletions common/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,7 @@ type SecretConfig struct {
Opts map[string]string `toml:"opts,omitempty"`
}

// ConfigMapConfig represents the "configmap" TOML config table
//
// revive does not like the name because the package is already called config
//
//nolint:revive
// ConfigMapConfig represents the "configmap" TOML config table.
type ConfigMapConfig struct {
// Driver specifies the configmap driver to use.
// Current valid value:
Expand Down
3 changes: 1 addition & 2 deletions common/pkg/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ var (
defaultContainerEnv = []string{"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}
)

// nolint:unparam
func parseSubnetPool(subnet string, size int) SubnetPool {
func parseSubnetPool(subnet string, size int) SubnetPool { //nolint:unparam // Suppress "size always receives 24".
_, n, _ := net.ParseCIDR(subnet)
return SubnetPool{
Base: &nettypes.IPNet{IPNet: *n},
Expand Down
4 changes: 0 additions & 4 deletions common/pkg/configmaps/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ type ConfigMap struct {
// ConfigMapsDriver interfaces with the configMaps data store.
// The driver stores the actual bytes of configMap data, as opposed to
// the configMap metadata.
//
// revive does not like the name because the package is already called configmaps
//
//nolint:revive
type ConfigMapsDriver interface {
// List lists all configMap ids in the configMaps data store
List() ([]string, error)
Expand Down
4 changes: 0 additions & 4 deletions common/pkg/filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ func ComputeUntilTimestamp(filterValues []string) (time.Time, error) {
//
// Please refer to https://github.com/containers/podman/issues/6899 for some
// background.
//
// revive does not like the name because the package is already called filters
//
//nolint:revive
func FiltersFromRequest(r *http.Request) ([]string, error) {
var (
compatFilters map[string]map[string]bool
Expand Down
8 changes: 4 additions & 4 deletions common/pkg/flag/flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func TestOptionalBoolIsBoolFlag(t *testing.T) {
cmd := &cobra.Command{
Use: "cmd",
RunE: func(_ *cobra.Command, args []string) error {
assert.Equal(t, c.expectedOB, ob) // nolint
assert.Equal(t, c.expectedArgs, args) //nolint
assert.Equal(t, c.expectedOB, ob)
assert.Equal(t, c.expectedArgs, args)
actionRun = true
return nil
},
Expand Down Expand Up @@ -206,8 +206,8 @@ func TestOptionalStringIsBoolFlag(t *testing.T) {
cmd := &cobra.Command{
Use: "cmd",
RunE: func(cmd *cobra.Command, args []string) error {
assert.Equal(t, c.expectedOS, os) // nolint
assert.Equal(t, c.expectedArgs, args) // nolint
assert.Equal(t, c.expectedOS, os)
assert.Equal(t, c.expectedArgs, args)
actionRun = true
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion common/pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func sliceToMap(s []string) map[string]string {

// AddInstance adds an entry for the specified manifest digest, with assorted
// additional information specified in parameters, to the list or index.
func (l *list) AddInstance(manifestDigest digest.Digest, manifestSize int64, manifestType, osName, architecture, osVersion string, osFeatures []string, variant string, features, annotations []string) error { // nolint:revive
func (l *list) AddInstance(manifestDigest digest.Digest, manifestSize int64, manifestType, osName, architecture, osVersion string, osFeatures []string, variant string, features, annotations []string) error {
if err := l.Remove(manifestDigest); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions common/pkg/parse/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ func TestDeviceParser(t *testing.T) {
assert.Equal(t, permissions, "rm")

// test bogus permissions
_, _, _, err = Device("/dev/fuse1:BOGUS") //nolint
_, _, _, err = Device("/dev/fuse1:BOGUS")
assert.Error(t, err)

_, _, _, err = Device("") //nolint
_, _, _, err = Device("")
assert.Error(t, err)

_, _, _, err = Device("/dev/foo:/dev/bar:rm:") //nolint
_, _, _, err = Device("/dev/foo:/dev/bar:rm:")
assert.Error(t, err)

_, _, _, err = Device("/dev/foo::rm") //nolint
_, _, _, err = Device("/dev/foo::rm")
assert.Error(t, err)
}

Expand Down
5 changes: 3 additions & 2 deletions common/pkg/report/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ func TestFormatter_HasTable(t *testing.T) {
type testFormatterStruct struct {
FieldA bool // camel case test
Fieldb bool // no camel case
fieldC bool // nolint // private field
fieldd bool // nolint // private field
// Private fields.
fieldC bool //nolint:unused
fieldd bool //nolint:unused
}

func TestFormatter_HeadersNoOverrides(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions common/pkg/report/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ func TestNewTemplate(t *testing.T) {
type testStruct struct {
FieldA bool // camel case test
Fieldb bool // no camel case
fieldC bool // nolint // private field
fieldd bool // nolint // private field
// Private fields.
fieldC bool //nolint:unused
fieldd bool //nolint:unused
}

func TestHeadersSimple(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions common/pkg/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ type Options struct {
}

// RetryOptions is deprecated, use Options.
type RetryOptions = Options // nolint:revive
type RetryOptions = Options

// RetryIfNecessary deprecated function use IfNecessary.
func RetryIfNecessary(ctx context.Context, operation func() error, options *Options) error { // nolint:revive
func RetryIfNecessary(ctx context.Context, operation func() error, options *Options) error {
return IfNecessary(ctx, operation, options)
}

Expand Down
10 changes: 1 addition & 9 deletions common/pkg/secrets/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ var errIgnoreIfExistsAndReplace = errors.New("ignoreIfExists and replace cannot
// secretsFile is the name of the file that the secrets database will be stored in.
var secretsFile = "secrets.json"

// SecretsManager holds information on handling secrets
//
// revive does not like the name because the package is already called secrets
//
//nolint:revive
// SecretsManager holds information on handling secrets.
type SecretsManager struct {
// secretsPath is the path to the db file where secrets are stored
secretsDBPath string
Expand Down Expand Up @@ -92,10 +88,6 @@ type Secret struct {
// The driver stores the actual bytes of secret data, as opposed to
// the secret metadata.
// Currently only the unencrypted filedriver is implemented.
//
// revive does not like the name because the package is already called secrets
//
//nolint:revive
type SecretsDriver interface {
// List lists all secret ids in the secrets data store
List() ([]string, error)
Expand Down
2 changes: 1 addition & 1 deletion common/pkg/umask/umask_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func Check() {
oldUmask := syscall.Umask(0o022) //nolint
oldUmask := syscall.Umask(0o022)
if (oldUmask & ^0o022) != 0 {
logrus.Debugf("umask value too restrictive. Forcing it to 022")
}
Expand Down
Loading