Skip to content

Commit

Permalink
Merge pull request #17 from ubuntu/dependabot/go_modules/tools/github…
Browse files Browse the repository at this point in the history
….com/golangci/golangci-lint-1.52.0
  • Loading branch information
GabrielNagy authored Mar 20, 2023
2 parents 55dc053 + ec66e24 commit b9924bb
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 131 deletions.
3 changes: 1 addition & 2 deletions cmd/ubuntu-proxy-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package main

import (
"context"
"errors"
"flag"
"fmt"
Expand All @@ -21,7 +20,7 @@ type cmd interface {
}

func main() {
c, err := app.New(context.Background())
c, err := app.New()
if err != nil {
log.Errorf("Failed to create app: %v", err)
os.Exit(1)
Expand Down
3 changes: 1 addition & 2 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package app

import (
"context"
"errors"
"fmt"
"sync"
Expand Down Expand Up @@ -106,7 +105,7 @@ func (b *proxyManagerBus) QuitRequested() bool {
}

// New creates a new App object.
func New(ctx context.Context, args ...option) (a *App, err error) {
func New(args ...option) (a *App, err error) {
defer decorate.OnError(&err, "cannot initialize application")

// Don't call dbus.SystemBus which caches globally system dbus (issues in tests)
Expand Down
15 changes: 7 additions & 8 deletions internal/app/app_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app_test

import (
"context"
"fmt"
"strings"
"testing"
Expand Down Expand Up @@ -32,7 +31,7 @@ func TestNew(t *testing.T) {
defer testutils.StartLocalSystemBus()()
}

_, err := app.New(context.Background())
_, err := app.New()
if tc.wantErr {
require.Error(t, err, "New should have failed but didn't")
return
Expand Down Expand Up @@ -69,7 +68,7 @@ func TestWait(t *testing.T) {
args[i] = tc.applyArgs[i]
}

a, err := app.New(context.Background(), app.WithAuthorizer(&app.MockAuthorizer{RejectAuth: tc.rejectAuth}), app.WithProxy(&app.MockProxy{ApplyError: tc.proxyApplyError}))
a, err := app.New(app.WithAuthorizer(&app.MockAuthorizer{RejectAuth: tc.rejectAuth}), app.WithProxy(&app.MockProxy{ApplyError: tc.proxyApplyError}))
require.NoError(t, err, "Setup: New should have succeeded but didn't")

done := make(chan struct{})
Expand Down Expand Up @@ -106,16 +105,16 @@ func TestWait(t *testing.T) {
func TestAppAlreadyExported(t *testing.T) {
defer testutils.StartLocalSystemBus()()

_, err := app.New(context.Background())
_, err := app.New()
require.NoError(t, err, "Setup: New should have succeeded but didn't")
_, err = app.New(context.Background())
_, err = app.New()
require.ErrorContains(t, err, "D-Bus name already taken")
}

func TestQuitApp(t *testing.T) {
defer testutils.StartLocalSystemBus()()

a, err := app.New(context.Background())
a, err := app.New()
require.NoError(t, err, "Setup: New should have succeeded but didn't")
var appErr error
done := make(chan struct{})
Expand All @@ -138,7 +137,7 @@ func TestQuitAppWithQueuedRuns(t *testing.T) {

sleepDuration := 10 * time.Millisecond
mockProxy := &app.MockProxy{SleepOnApply: sleepDuration}
a, err := app.New(context.Background(), app.WithProxy(mockProxy), app.WithAuthorizer(&app.MockAuthorizer{}))
a, err := app.New(app.WithProxy(mockProxy), app.WithAuthorizer(&app.MockAuthorizer{}))
require.NoError(t, err, "Setup: New should have succeeded but didn't")

done := make(chan struct{})
Expand Down Expand Up @@ -182,7 +181,7 @@ func TestQuitAppWithQueuedRuns(t *testing.T) {
func TestMultipleRunsErrorsAreJoined(t *testing.T) {
defer testutils.StartLocalSystemBus()()

a, err := app.New(context.Background(), app.WithProxy(&app.MockProxy{ApplyError: true, SleepOnApply: 5 * time.Millisecond}), app.WithAuthorizer(&app.MockAuthorizer{}))
a, err := app.New(app.WithProxy(&app.MockProxy{ApplyError: true, SleepOnApply: 5 * time.Millisecond}), app.WithAuthorizer(&app.MockAuthorizer{}))
require.NoError(t, err, "Setup: New should have succeeded but didn't")

var appErr error
Expand Down
2 changes: 1 addition & 1 deletion internal/app/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type MockProxy struct {
}

// CheckSenderAllowed is a mock implementation of authorizerer, returning an error if requested in the mock.
func (m *MockAuthorizer) CheckSenderAllowed(action string, sender dbus.Sender) (err error) {
func (m *MockAuthorizer) CheckSenderAllowed(_ string, _ dbus.Sender) (err error) {
if m.RejectAuth {
err = errors.New("authorization rejected")
}
Expand Down
4 changes: 2 additions & 2 deletions internal/authorizer/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type PolkitObjMock struct {
}

// Call mocks the polkit object call.
func (d *PolkitObjMock) Call(method string, flags dbus.Flags, args ...interface{}) *dbus.Call {
func (d *PolkitObjMock) Call(_ string, _ dbus.Flags, args ...interface{}) *dbus.Call {
var errPolkit error

content, ok := args[1].(string)
Expand Down Expand Up @@ -73,7 +73,7 @@ type CredsObjMock struct {
}

// Call mocks the credentials object call.
func (d *CredsObjMock) Call(method string, flags dbus.Flags, args ...interface{}) *dbus.Call {
func (d *CredsObjMock) Call(_ string, _ dbus.Flags, _ ...interface{}) *dbus.Call {
var errCredsLookup error

if d.WantLookupError {
Expand Down
5 changes: 1 addition & 4 deletions internal/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ func safeWriteFile(path string, contents string) error {
if err := os.WriteFile(path+".new", []byte(contents), 0644); err != nil {
return err
}
if err := os.Rename(path+".new", path); err != nil {
return err
}
return nil
return os.Rename(path+".new", path)
}

// backupFileIfExists moves the given file to a backup file suffixed with .old,
Expand Down
69 changes: 34 additions & 35 deletions tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@ module github.com/ubuntu/ubuntu-proxy-manager/tools

go 1.20

require github.com/golangci/golangci-lint v1.51.2
require github.com/golangci/golangci-lint v1.52.0

require (
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
4d63.com/gochecknoglobals v0.2.1 // indirect
github.com/Abirdcfly/dupword v0.0.9 // indirect
github.com/Antonboom/errname v0.1.7 // indirect
github.com/Antonboom/nilnil v0.1.1 // indirect
github.com/Abirdcfly/dupword v0.0.11 // indirect
github.com/Antonboom/errname v0.1.9 // indirect
github.com/Antonboom/nilnil v0.1.3 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/OpenPeeDeeP/depguard v1.1.1 // indirect
github.com/alexkohler/prealloc v1.0.0 // indirect
github.com/alingse/asasalint v0.0.11 // indirect
github.com/ashanbrown/forbidigo v1.4.0 // indirect
github.com/ashanbrown/forbidigo v1.5.1 // indirect
github.com/ashanbrown/makezero v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bkielbasa/cyclop v1.2.0 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
github.com/breml/bidichk v0.2.3 // indirect
github.com/breml/errchkjson v0.3.0 // indirect
github.com/breml/bidichk v0.2.4 // indirect
github.com/breml/errchkjson v0.3.1 // indirect
github.com/butuzov/ireturn v0.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/charithe/durationcheck v0.0.9 // indirect
github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.9.1 // indirect
github.com/daixiang0/gci v0.10.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denis-tingaikin/go-header v0.4.3 // indirect
github.com/esimonov/ifshort v1.0.4 // indirect
github.com/ettle/strcase v0.1.1 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/firefart/nonamedreturns v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/go-critic/go-critic v0.6.7 // indirect
github.com/go-critic/go-critic v0.7.0 // indirect
github.com/go-toolsmith/astcast v1.1.0 // indirect
github.com/go-toolsmith/astcopy v1.0.3 // indirect
github.com/go-toolsmith/astcopy v1.1.0 // indirect
github.com/go-toolsmith/astequal v1.1.0 // indirect
github.com/go-toolsmith/astfmt v1.1.0 // indirect
github.com/go-toolsmith/astp v1.1.0 // indirect
Expand Down Expand Up @@ -77,10 +77,10 @@ require (
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
github.com/julz/importas v0.1.0 // indirect
github.com/junk1tm/musttag v0.4.5 // indirect
github.com/junk1tm/musttag v0.5.0 // indirect
github.com/kisielk/errcheck v1.6.3 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.3 // indirect
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
github.com/kulti/thelper v0.6.3 // indirect
github.com/kunwardeep/paralleltest v1.0.6 // indirect
github.com/kyoh86/exportloopref v0.1.11 // indirect
Expand All @@ -90,35 +90,34 @@ require (
github.com/lufeee/execinquery v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/maratori/testableexamples v1.0.0 // indirect
github.com/maratori/testpackage v1.1.0 // indirect
github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect
github.com/maratori/testpackage v1.1.1 // indirect
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
github.com/mgechev/revive v1.2.5 // indirect
github.com/mgechev/revive v1.3.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moricho/tparallel v0.2.1 // indirect
github.com/moricho/tparallel v0.3.0 // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
github.com/nishanths/exhaustive v0.9.5 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
github.com/nunnatsa/ginkgolinter v0.8.1 // indirect
github.com/nunnatsa/ginkgolinter v0.9.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polyfloyd/go-errorlint v1.1.0 // indirect
github.com/polyfloyd/go-errorlint v1.4.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/quasilyte/go-ruleguard v0.3.19 // indirect
github.com/quasilyte/gogrep v0.5.0 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
github.com/ryancurrah/gomodguard v1.3.0 // indirect
github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect
Expand All @@ -131,7 +130,7 @@ require (
github.com/sivchari/containedctx v1.0.2 // indirect
github.com/sivchari/nosnakecase v1.7.0 // indirect
github.com/sivchari/tenv v1.7.1 // indirect
github.com/sonatard/noctx v0.0.1 // indirect
github.com/sonatard/noctx v0.0.2 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
Expand All @@ -142,14 +141,14 @@ require (
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
github.com/tdakkota/asciicheck v0.1.1 // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tetafro/godot v1.4.11 // indirect
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect
github.com/timonwong/loggercheck v0.9.3 // indirect
github.com/tomarrell/wrapcheck/v2 v2.8.0 // indirect
github.com/timonwong/loggercheck v0.9.4 // indirect
github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/ultraware/funlen v0.0.3 // indirect
github.com/ultraware/whitespace v0.0.5 // indirect
Expand All @@ -159,19 +158,19 @@ require (
gitlab.com/bosi/decorder v0.2.3 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.7.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.4.2 // indirect
honnef.co/go/tools v0.4.3 // indirect
mvdan.cc/gofumpt v0.4.0 // indirect
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
Expand Down
Loading

0 comments on commit b9924bb

Please sign in to comment.