From 8a4ac4dec3c105b7eeb2736a3770919723b00cd0 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Thu, 11 Nov 2021 17:03:11 -0800 Subject: [PATCH] Upgraded linter to 1.43.0 (#1505) * fixed new gocritic violations * fixed new 'contextcheck' violations * fixed 'gosec' warnings * suppressed ireturn and varnamelen linters * fixed tenv violations, enabled building robustness tests on arm64 * fixed remaining linux failures * makefile: fixed 'lint-all' target when running on arm64 * linter: increase deadline * disable nilnil linter - to be enabled in separate PR --- .golangci.yml | 4 +++ Makefile | 9 +++-- cli/app.go | 4 +-- cli/command_policy_set_actions.go | 2 +- cli/command_repository.go | 8 ++--- cli/command_snapshot_list.go | 2 +- cli/inproc.go | 2 +- cli/update_check.go | 7 ++-- .../mount/mount_posix_webdav_helper_darwin.go | 4 +-- .../mount/mount_posix_webdav_helper_linux.go | 4 +-- internal/server/api_manifest.go | 8 ++--- internal/server/server.go | 4 +-- internal/server/server_authz_checks.go | 7 ++-- internal/testutil/dockertestutil.go | 2 +- internal/testutil/tmpdir.go | 2 +- repo/blob/gcs/gcs_storage.go | 10 +++--- repo/blob/sftp/sftp_storage.go | 2 +- repo/open.go | 2 +- snapshot/policy/policy_manager_test.go | 5 ++- snapshot/snapshotfs/upload_test.go | 2 +- tests/end_to_end_test/server_start_test.go | 2 +- tests/robustness/checker/checker.go | 4 +-- tests/robustness/engine/action.go | 4 +-- tests/robustness/engine/engine.go | 4 +-- tests/robustness/engine/engine_test.go | 36 +++++++++---------- tests/robustness/engine/log.go | 4 +-- tests/robustness/engine/metadata.go | 4 +-- tests/robustness/engine/stats.go | 4 +-- tests/robustness/errors.go | 4 +-- tests/robustness/filewriter.go | 4 +-- .../fiofilewriter/fio_filewriter.go | 4 +-- .../multiclient_test/framework/client.go | 4 +-- .../multiclient_test/framework/filewriter.go | 4 +-- .../multiclient_test/framework/framework.go | 4 +-- .../multiclient_test/framework/harness.go | 4 +-- .../multiclient_test/framework/snapshotter.go | 4 +-- .../robustness/multiclient_test/main_test.go | 4 +-- .../multiclient_test/multiclient_test.go | 4 +-- tests/robustness/options.go | 4 +-- tests/robustness/persister.go | 4 +-- tests/robustness/robustness_test/main_test.go | 4 +-- .../robustness_test/robustness_test.go | 4 +-- tests/robustness/snapmeta/index.go | 4 +-- tests/robustness/snapmeta/index_test.go | 4 +-- tests/robustness/snapmeta/kopia_connector.go | 4 +-- .../snapmeta/kopia_connector_test.go | 23 ++++++------ tests/robustness/snapmeta/kopia_persister.go | 4 +-- .../snapmeta/kopia_persister_light.go | 4 +-- .../snapmeta/kopia_persister_light_test.go | 6 ++-- .../robustness/snapmeta/kopia_snapshotter.go | 6 ++-- tests/robustness/snapmeta/simple.go | 4 +-- tests/robustness/snapmeta/simple_test.go | 4 +-- tests/robustness/snapshotter.go | 4 +-- tests/tools/fswalker/fswalker.go | 4 +-- tests/tools/fswalker/fswalker_test.go | 4 +-- tests/tools/fswalker/reporter/reporter.go | 4 +-- .../tools/fswalker/reporter/reporter_test.go | 4 +-- tests/tools/fswalker/walker/walker.go | 4 +-- tests/tools/fswalker/walker/walker_test.go | 4 +-- tests/tools/kopiaclient/kopiaclient.go | 4 +-- tools/gettool/checksums.txt | 12 +++---- tools/tools.mk | 2 +- 62 files changed, 159 insertions(+), 158 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f7130a892..edae76827 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -67,6 +67,9 @@ linters: - gochecknoglobals - gochecknoinits - whitespace + - nilnil + - ireturn # this one may be interesting to control allocations + - varnamelen # this one may be interesting, but too much churn - nlreturn - testpackage - ifshort @@ -92,6 +95,7 @@ issues: - wrapcheck - nolintlint - forcetypeassert + - contextcheck - text: "Magic number: 1e" linters: - gomnd diff --git a/Makefile b/Makefile index bd4d8c053..ac98f4065 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ GOTESTSUM_FORMAT=pkgname-and-test-fails GOTESTSUM_FLAGS=--format=$(GOTESTSUM_FORMAT) --no-summary=skipped GO_TEST?=$(gotestsum) $(GOTESTSUM_FLAGS) -- -LINTER_DEADLINE=300s +LINTER_DEADLINE=600s UNIT_TESTS_TIMEOUT=300s ifeq ($(GOARCH),amd64) @@ -68,15 +68,14 @@ lint-and-log: $(linter) $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) | tee .linterr.txt lint-all: $(linter) - GOOS=windows $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) - GOOS=linux $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) + GOOS=windows GOARCH=amd64 $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) GOOS=linux GOARCH=amd64 $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) GOOS=linux GOARCH=arm64 $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) GOOS=linux GOARCH=arm $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) GOOS=darwin GOARCH=amd64 $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) GOOS=darwin GOARCH=arm64 $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) - GOOS=openbsd $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) - GOOS=freebsd $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) + GOOS=openbsd GOARCH=amd64 $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) + GOOS=freebsd GOARCH=amd64 $(linter) --deadline $(LINTER_DEADLINE) run $(linter_flags) vet: go vet -all . diff --git a/cli/app.go b/cli/app.go index f65149076..dbc524c58 100644 --- a/cli/app.go +++ b/cli/app.go @@ -249,7 +249,7 @@ func (c *App) setup(app *kingpin.Application) { c.policy.setup(c, app) c.mount.setup(c, app) c.maintenance.setup(c, app) - c.repository.setup(c, app) + c.repository.setup(c, app) // nolint:contextcheck } // commandParent is implemented by app and commands that can have sub-commands. @@ -272,7 +272,7 @@ func NewApp() *App { // Attach attaches the CLI parser to the application. func (c *App) Attach(app *kingpin.Application) { - c.setup(app) + c.setup(app) // nolint:contextcheck } var safetyByName = map[string]maintenance.SafetyParameters{ diff --git a/cli/command_policy_set_actions.go b/cli/command_policy_set_actions.go index 10be72ca9..dfbd6d765 100644 --- a/cli/command_policy_set_actions.go +++ b/cli/command_policy_set_actions.go @@ -80,7 +80,7 @@ func (c *policyActionFlags) setActionCommandFromFlags(ctx context.Context, actio *changeCount++ if c.policySetPersistActionScript { - script, err := os.ReadFile(value) + script, err := os.ReadFile(value) //nolint:gosec if err != nil { return errors.Wrap(err, "unable to read script file") } diff --git a/cli/command_repository.go b/cli/command_repository.go index 58591ff3e..bb94d0e0a 100644 --- a/cli/command_repository.go +++ b/cli/command_repository.go @@ -16,14 +16,14 @@ type commandRepository struct { func (c *commandRepository) setup(svc advancedAppServices, parent commandParent) { cmd := parent.Command("repository", "Commands to manipulate repository.").Alias("repo") - c.connect.setup(svc, cmd) - c.create.setup(svc, cmd) + c.connect.setup(svc, cmd) // nolint:contextcheck + c.create.setup(svc, cmd) // nolint:contextcheck c.disconnect.setup(svc, cmd) - c.repair.setup(svc, cmd) + c.repair.setup(svc, cmd) // nolint:contextcheck c.setClient.setup(svc, cmd) c.setParameters.setup(svc, cmd) c.status.setup(svc, cmd) - c.syncTo.setup(svc, cmd) + c.syncTo.setup(svc, cmd) // nolint:contextcheck c.changePassword.setup(svc, cmd) c.validateProvider.setup(svc, cmd) } diff --git a/cli/command_snapshot_list.go b/cli/command_snapshot_list.go index cbdc41bca..6e8c350dc 100644 --- a/cli/command_snapshot_list.go +++ b/cli/command_snapshot_list.go @@ -275,7 +275,7 @@ func (c *commandSnapshotList) entryBits(ctx context.Context, m *snapshot.Manifes bits = append(bits, maybeHumanReadableBytes(c.snapshotListShowHumanReadable, ent.Size()), - fmt.Sprintf("%v", ent.Mode())) + ent.Mode().String()) if c.shapshotListShowOwner { bits = append(bits, fmt.Sprintf("uid:%v", ent.Owner().UserID), diff --git a/cli/inproc.go b/cli/inproc.go index d3f195560..a1a352369 100644 --- a/cli/inproc.go +++ b/cli/inproc.go @@ -20,7 +20,7 @@ func (c *App) RunSubcommand(ctx context.Context, kpapp *kingpin.Application, arg c.stderrWriter = stderrWriter c.rootctx = logging.WithLogger(ctx, logging.Writer(stderrWriter)) - c.Attach(kpapp) + c.Attach(kpapp) // nolint:contextcheck var exitCode int diff --git a/cli/update_check.go b/cli/update_check.go index 1b84aa1d9..6b635ff91 100644 --- a/cli/update_check.go +++ b/cli/update_check.go @@ -7,7 +7,6 @@ "fmt" "net/http" "os" - "path/filepath" "strconv" "strings" "time" @@ -50,7 +49,7 @@ type updateState struct { // updateStateFilename returns the name of the update state. func (c *App) updateStateFilename() string { - return filepath.Join(c.repositoryConfigFileName() + ".update-info.json") + return c.repositoryConfigFileName() + ".update-info.json" } // writeUpdateState writes update state file. @@ -108,7 +107,7 @@ func getLatestReleaseNameFromGitHub(ctx context.Context) (string, error) { ctx, cancel := context.WithTimeout(ctx, githubTimeout) defer cancel() - req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf(latestReleaseGitHubURLFormat, repo.BuildGitHubRepo), nil) + req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf(latestReleaseGitHubURLFormat, repo.BuildGitHubRepo), http.NoBody) if err != nil { return "", errors.Wrap(err, "unable to get latest release from github") } @@ -139,7 +138,7 @@ func verifyGitHubReleaseIsComplete(ctx context.Context, releaseName string) erro ctx, cancel := context.WithTimeout(ctx, githubTimeout) defer cancel() - req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf(checksumsURLFormat, repo.BuildGitHubRepo, releaseName), nil) + req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf(checksumsURLFormat, repo.BuildGitHubRepo, releaseName), http.NoBody) if err != nil { return errors.Wrap(err, "unable to download releases checksum") } diff --git a/internal/mount/mount_posix_webdav_helper_darwin.go b/internal/mount/mount_posix_webdav_helper_darwin.go index 840590c49..a6e7b628d 100644 --- a/internal/mount/mount_posix_webdav_helper_darwin.go +++ b/internal/mount/mount_posix_webdav_helper_darwin.go @@ -8,7 +8,7 @@ ) func mountWebDavHelper(ctx context.Context, url, path string) error { - mount := exec.Command("/sbin/mount", "-t", "webdav", "-r", url, path) //nolint:gosec + mount := exec.Command("/sbin/mount", "-t", "webdav", "-r", url, path) if err := mount.Run(); err != nil { return errors.Errorf("webdav mount %q on %q failed: %v", url, path, err) } @@ -17,7 +17,7 @@ func mountWebDavHelper(ctx context.Context, url, path string) error { } func unmountWebDevHelper(ctx context.Context, path string) error { - unmount := exec.Command("/usr/sbin/diskutil", "unmount", path) //nolint:gosec + unmount := exec.Command("/usr/sbin/diskutil", "unmount", path) if err := unmount.Run(); err != nil { return errors.Errorf("unmount %q failed: %v", path, err) } diff --git a/internal/mount/mount_posix_webdav_helper_linux.go b/internal/mount/mount_posix_webdav_helper_linux.go index e222f319d..8d68560dc 100644 --- a/internal/mount/mount_posix_webdav_helper_linux.go +++ b/internal/mount/mount_posix_webdav_helper_linux.go @@ -6,7 +6,7 @@ ) func mountWebDavHelper(ctx context.Context, url, path string) error { - mount := exec.Command("/usr/bin/mount", "-t", "davfs", "-r", url, path) //nolint:gosec + mount := exec.Command("/usr/bin/mount", "-t", "davfs", "-r", url, path) if err := mount.Run(); err != nil { log(ctx).Errorf("mount command failed: %v. Cowardly refusing to run with root permissions. Try \"sudo /usr/bin/mount -t davfs -r %s %s\"\n", err, url, path) } @@ -15,7 +15,7 @@ func mountWebDavHelper(ctx context.Context, url, path string) error { } func unmountWebDevHelper(ctx context.Context, path string) error { - unmount := exec.Command("/usr/bin/umount", path) //nolint:gosec + unmount := exec.Command("/usr/bin/umount", path) if err := unmount.Run(); err != nil { log(ctx).Errorf("umount command failed: %v. Cowardly refusing to run with root permissions. Try \"sudo /usr/bin/umount %s\"\n", err, path) } diff --git a/internal/server/api_manifest.go b/internal/server/api_manifest.go index b5e5bb2a4..fd36b43af 100644 --- a/internal/server/api_manifest.go +++ b/internal/server/api_manifest.go @@ -29,7 +29,7 @@ func (s *Server) handleManifestGet(ctx context.Context, r *http.Request, body [] return nil, internalServerError(err) } - if !hasManifestAccess(s, r, md.Labels, auth.AccessLevelRead) { + if !hasManifestAccess(ctx, s, r, md.Labels, auth.AccessLevelRead) { return nil, accessDeniedError() } @@ -58,7 +58,7 @@ func (s *Server) handleManifestDelete(ctx context.Context, r *http.Request, body return nil, internalServerError(err) } - if !hasManifestAccess(s, r, em.Labels, auth.AccessLevelFull) { + if !hasManifestAccess(ctx, s, r, em.Labels, auth.AccessLevelFull) { return nil, accessDeniedError() } @@ -87,7 +87,7 @@ func (s *Server) handleManifestList(ctx context.Context, r *http.Request, body [ return nil, internalServerError(err) } - return filterManifests(m, s.httpAuthorizationInfo(r)), nil + return filterManifests(m, s.httpAuthorizationInfo(ctx, r)), nil } func filterManifests(manifests []*manifest.EntryMetadata, authz auth.AuthorizationInfo) []*manifest.EntryMetadata { @@ -114,7 +114,7 @@ func (s *Server) handleManifestCreate(ctx context.Context, r *http.Request, body return nil, requestError(serverapi.ErrorMalformedRequest, "malformed request") } - if !hasManifestAccess(s, r, req.Metadata.Labels, auth.AccessLevelAppend) { + if !hasManifestAccess(ctx, s, r, req.Metadata.Labels, auth.AccessLevelAppend) { return nil, accessDeniedError() } diff --git a/internal/server/server.go b/internal/server/server.go index 591c501b9..44bfa851b 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -220,11 +220,11 @@ func (s *Server) requireAuth(f http.HandlerFunc) http.HandlerFunc { } } -func (s *Server) httpAuthorizationInfo(r *http.Request) auth.AuthorizationInfo { +func (s *Server) httpAuthorizationInfo(ctx context.Context, r *http.Request) auth.AuthorizationInfo { // authentication already done userAtHost, _, _ := r.BasicAuth() - authz := s.authorizer.Authorize(r.Context(), s.rep, userAtHost) + authz := s.authorizer.Authorize(ctx, s.rep, userAtHost) if authz == nil { authz = auth.NoAccess() } diff --git a/internal/server/server_authz_checks.go b/internal/server/server_authz_checks.go index 6882a7300..9c07f2312 100644 --- a/internal/server/server_authz_checks.go +++ b/internal/server/server_authz_checks.go @@ -1,6 +1,7 @@ package server import ( + "context" "net/http" "github.com/kopia/kopia/internal/auth" @@ -26,12 +27,12 @@ func handlerWillCheckAuthorization(s *Server, r *http.Request) bool { func requireContentAccess(level auth.AccessLevel) isAuthorizedFunc { return func(s *Server, r *http.Request) bool { - return s.httpAuthorizationInfo(r).ContentAccessLevel() >= level + return s.httpAuthorizationInfo(r.Context(), r).ContentAccessLevel() >= level } } -func hasManifestAccess(s *Server, r *http.Request, labels map[string]string, level auth.AccessLevel) bool { - return s.httpAuthorizationInfo(r).ManifestAccessLevel(labels) >= level +func hasManifestAccess(ctx context.Context, s *Server, r *http.Request, labels map[string]string, level auth.AccessLevel) bool { + return s.httpAuthorizationInfo(ctx, r).ManifestAccessLevel(labels) >= level } var ( diff --git a/internal/testutil/dockertestutil.go b/internal/testutil/dockertestutil.go index 1521704da..9f5fa2f6c 100644 --- a/internal/testutil/dockertestutil.go +++ b/internal/testutil/dockertestutil.go @@ -14,7 +14,7 @@ func RunDockerAndGetOutputOrSkip(tb testing.TB, args ...string) string { tb.Helper() tb.Logf("running docker %v", args) - c := exec.Command("docker", args...) //nolint:gosec + c := exec.Command("docker", args...) var stderr bytes.Buffer diff --git a/internal/testutil/tmpdir.go b/internal/testutil/tmpdir.go index 27186cc6f..a4da6573c 100644 --- a/internal/testutil/tmpdir.go +++ b/internal/testutil/tmpdir.go @@ -121,7 +121,7 @@ func dumpLogs(t *testing.T, dirname string) { func dumpLogFile(t *testing.T, fname string) { t.Helper() - data, err := os.ReadFile(fname) + data, err := os.ReadFile(fname) // nolint:gosec if err != nil { t.Error(err) return diff --git a/repo/blob/gcs/gcs_storage.go b/repo/blob/gcs/gcs_storage.go index a7055d703..ce11a9d5a 100644 --- a/repo/blob/gcs/gcs_storage.go +++ b/repo/blob/gcs/gcs_storage.go @@ -33,7 +33,6 @@ type gcsStorage struct { Options - ctx context.Context storageClient *gcsclient.Client bucket *gcsclient.BucketHandle @@ -47,7 +46,7 @@ func (gcs *gcsStorage) GetBlob(ctx context.Context, b blob.ID, offset, length in } attempt := func() error { - reader, err := gcs.bucket.Object(gcs.getObjectNameString(b)).NewRangeReader(gcs.ctx, offset, length) + reader, err := gcs.bucket.Object(gcs.getObjectNameString(b)).NewRangeReader(ctx, offset, length) if err != nil { return errors.Wrap(err, "NewRangeReader") } @@ -126,7 +125,7 @@ func (gcs *gcsStorage) SetTime(ctx context.Context, b blob.ID, t time.Time) erro } func (gcs *gcsStorage) DeleteBlob(ctx context.Context, b blob.ID) error { - err := translateError(gcs.bucket.Object(gcs.getObjectNameString(b)).Delete(gcs.ctx)) + err := translateError(gcs.bucket.Object(gcs.getObjectNameString(b)).Delete(ctx)) if errors.Is(err, blob.ErrBlobNotFound) { return nil } @@ -139,7 +138,7 @@ func (gcs *gcsStorage) getObjectNameString(blobID blob.ID) string { } func (gcs *gcsStorage) ListBlobs(ctx context.Context, prefix blob.ID, callback func(blob.Metadata) error) error { - lst := gcs.bucket.Objects(gcs.ctx, &gcsclient.Query{ + lst := gcs.bucket.Objects(ctx, &gcsclient.Query{ Prefix: gcs.getObjectNameString(prefix), }) @@ -191,7 +190,7 @@ func toBandwidth(bytesPerSecond int) iothrottler.Bandwidth { } func tokenSourceFromCredentialsFile(ctx context.Context, fn string, scopes ...string) (oauth2.TokenSource, error) { - data, err := os.ReadFile(fn) + data, err := os.ReadFile(fn) //nolint:gosec if err != nil { return nil, errors.Wrap(err, "error reading credentials file") } @@ -258,7 +257,6 @@ func New(ctx context.Context, opt *Options) (blob.Storage, error) { gcs := &gcsStorage{ Options: *opt, - ctx: ctx, storageClient: cli, bucket: cli.Bucket(opt.BucketName), downloadThrottler: downloadThrottler, diff --git a/repo/blob/sftp/sftp_storage.go b/repo/blob/sftp/sftp_storage.go index 3673c3fff..ec67e7440 100644 --- a/repo/blob/sftp/sftp_storage.go +++ b/repo/blob/sftp/sftp_storage.go @@ -295,7 +295,7 @@ func writeKnownHostsDataStringToTempFile(data string) (string, error) { defer tf.Close() //nolint:errcheck,gosec - if _, err := io.WriteString(tf, data); err != nil { + if _, err := tf.WriteString(data); err != nil { return "", errors.Wrap(err, "error writing temporary file") } diff --git a/repo/open.go b/repo/open.go index 5e6e163cc..715d58afb 100644 --- a/repo/open.go +++ b/repo/open.go @@ -316,7 +316,7 @@ func readFormatBlobBytesFromCache(ctx context.Context, cachedFile string, validD return nil, errors.Errorf("cached file too old") } - return os.ReadFile(cachedFile) //nolint:wrapcheck + return os.ReadFile(cachedFile) //nolint:wrapcheck,gosec } func readAndCacheFormatBlobBytes(ctx context.Context, st blob.Storage, cacheDirectory string, validDuration time.Duration) ([]byte, error) { diff --git a/snapshot/policy/policy_manager_test.go b/snapshot/policy/policy_manager_test.go index 45eb45535..7a47237c4 100644 --- a/snapshot/policy/policy_manager_test.go +++ b/snapshot/policy/policy_manager_test.go @@ -2,7 +2,6 @@ import ( "encoding/json" - "fmt" "sort" "testing" @@ -109,7 +108,7 @@ func TestPolicyManagerInheritanceTest(t *testing.T) { for _, tc := range cases { tc := tc - t.Run(fmt.Sprintf("%v", tc.sourceInfo), func(t *testing.T) { + t.Run(tc.sourceInfo.String(), func(t *testing.T) { pol, src, err := GetEffectivePolicy(ctx, env.RepositoryWriter, tc.sourceInfo) if err != nil { t.Fatalf("err: %v", err) @@ -392,7 +391,7 @@ func TestApplicablePoliciesForSource(t *testing.T) { for _, tc := range cases { tc := tc - t.Run(fmt.Sprintf("%v", tc.si), func(t *testing.T) { + t.Run(tc.si.String(), func(t *testing.T) { res, err := applicablePoliciesForSource(ctx, env.RepositoryWriter, tc.si) if err != nil { t.Fatalf("error in applicablePoliciesForSource(%v): %v", tc.si, err) diff --git a/snapshot/snapshotfs/upload_test.go b/snapshot/snapshotfs/upload_test.go index ba91cb492..7aa1e58c4 100644 --- a/snapshot/snapshotfs/upload_test.go +++ b/snapshot/snapshotfs/upload_test.go @@ -992,7 +992,7 @@ func TestUploadLogging(t *testing.T) { } for _, tc := range cases { - t.Run(fmt.Sprintf("%v", tc.desc), func(t *testing.T) { + t.Run(tc.desc, func(t *testing.T) { ml := &mockLogger{ Logger: logging.NullLogger, } diff --git a/tests/end_to_end_test/server_start_test.go b/tests/end_to_end_test/server_start_test.go index 1af622dcf..85bd99183 100644 --- a/tests/end_to_end_test/server_start_test.go +++ b/tests/end_to_end_test/server_start_test.go @@ -460,7 +460,7 @@ func verifySourceCount(t *testing.T, cli *apiclient.KopiaAPIClient, match *snaps func verifyUIServedWithCorrectTitle(t *testing.T, cli *apiclient.KopiaAPIClient, sp serverParameters) { t.Helper() - req, err := http.NewRequestWithContext(context.Background(), "GET", sp.baseURL, nil) + req, err := http.NewRequestWithContext(context.Background(), "GET", sp.baseURL, http.NoBody) require.NoError(t, err) req.SetBasicAuth("kopia", sp.password) diff --git a/tests/robustness/checker/checker.go b/tests/robustness/checker/checker.go index bf724cff5..011037c66 100644 --- a/tests/robustness/checker/checker.go +++ b/tests/robustness/checker/checker.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package checker defines the framework for creating and restoring snapshots // with a data integrity check diff --git a/tests/robustness/engine/action.go b/tests/robustness/engine/action.go index 860c84fa9..eda73ac63 100644 --- a/tests/robustness/engine/action.go +++ b/tests/robustness/engine/action.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package engine diff --git a/tests/robustness/engine/engine.go b/tests/robustness/engine/engine.go index 014b94e4a..b8840125b 100644 --- a/tests/robustness/engine/engine.go +++ b/tests/robustness/engine/engine.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package engine provides the framework for a snapshot repository testing engine package engine diff --git a/tests/robustness/engine/engine_test.go b/tests/robustness/engine/engine_test.go index 63d424576..ee8b8cb5f 100644 --- a/tests/robustness/engine/engine_test.go +++ b/tests/robustness/engine/engine_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package engine provides the framework for a snapshot repository testing engine package engine @@ -51,8 +51,8 @@ ) func TestEngineWritefilesBasicFS(t *testing.T) { - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, "") + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, "") ctx := testlogging.Context(t) @@ -168,8 +168,8 @@ func TestWriteFilesBasicS3(t *testing.T) { bucketName, cleanupCB := makeTempS3Bucket(t) defer cleanupCB() - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) ctx := testlogging.Context(t) @@ -215,8 +215,8 @@ func TestDeleteSnapshotS3(t *testing.T) { bucketName, cleanupCB := makeTempS3Bucket(t) defer cleanupCB() - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) ctx := testlogging.Context(t) @@ -263,8 +263,8 @@ func TestSnapshotVerificationFail(t *testing.T) { bucketName, cleanupCB := makeTempS3Bucket(t) defer cleanupCB() - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) ctx := testlogging.Context(t) @@ -329,8 +329,8 @@ func TestSnapshotVerificationFail(t *testing.T) { } func TestDataPersistency(t *testing.T) { - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, "") + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, "") tempDir := testutil.TempDirectory(t) @@ -502,8 +502,8 @@ func TestPickActionWeighted(t *testing.T) { } func TestActionsFilesystem(t *testing.T) { - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, "") + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, "") ctx := testlogging.Context(t) @@ -551,8 +551,8 @@ func TestActionsS3(t *testing.T) { bucketName, cleanupCB := makeTempS3Bucket(t) defer cleanupCB() - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, bucketName) ctx := testlogging.Context(t) @@ -598,8 +598,8 @@ func TestIOLimitPerWriteAction(t *testing.T) { // Instruct a write action to write a large amount of data, but add // an I/O limit parameter. Expect that the FIO action should limit // the amount of data it writes. - os.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) - os.Setenv(snapmeta.S3BucketNameEnvKey, "") + t.Setenv(snapmeta.EngineModeEnvKey, snapmeta.EngineModeBasic) + t.Setenv(snapmeta.S3BucketNameEnvKey, "") ctx := testlogging.Context(t) diff --git a/tests/robustness/engine/log.go b/tests/robustness/engine/log.go index f41e6dad2..4c963b141 100644 --- a/tests/robustness/engine/log.go +++ b/tests/robustness/engine/log.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package engine diff --git a/tests/robustness/engine/metadata.go b/tests/robustness/engine/metadata.go index 256f39171..b1bb77232 100644 --- a/tests/robustness/engine/metadata.go +++ b/tests/robustness/engine/metadata.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package engine diff --git a/tests/robustness/engine/stats.go b/tests/robustness/engine/stats.go index fa3e0a484..6e694a3c4 100644 --- a/tests/robustness/engine/stats.go +++ b/tests/robustness/engine/stats.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package engine diff --git a/tests/robustness/errors.go b/tests/robustness/errors.go index 6b42aa27e..99f26da35 100644 --- a/tests/robustness/errors.go +++ b/tests/robustness/errors.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package robustness diff --git a/tests/robustness/filewriter.go b/tests/robustness/filewriter.go index da6ea0eb8..15b31aff5 100644 --- a/tests/robustness/filewriter.go +++ b/tests/robustness/filewriter.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package robustness diff --git a/tests/robustness/fiofilewriter/fio_filewriter.go b/tests/robustness/fiofilewriter/fio_filewriter.go index 270c6b91e..abc51fbd9 100644 --- a/tests/robustness/fiofilewriter/fio_filewriter.go +++ b/tests/robustness/fiofilewriter/fio_filewriter.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package fiofilewriter provides a FileWriter based on FIO. package fiofilewriter diff --git a/tests/robustness/multiclient_test/framework/client.go b/tests/robustness/multiclient_test/framework/client.go index fde38246c..7cba44eab 100644 --- a/tests/robustness/multiclient_test/framework/client.go +++ b/tests/robustness/multiclient_test/framework/client.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package framework diff --git a/tests/robustness/multiclient_test/framework/filewriter.go b/tests/robustness/multiclient_test/framework/filewriter.go index 2f0860bc8..dad591926 100644 --- a/tests/robustness/multiclient_test/framework/filewriter.go +++ b/tests/robustness/multiclient_test/framework/filewriter.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package framework diff --git a/tests/robustness/multiclient_test/framework/framework.go b/tests/robustness/multiclient_test/framework/framework.go index 73e09e432..f05ebcd6c 100644 --- a/tests/robustness/multiclient_test/framework/framework.go +++ b/tests/robustness/multiclient_test/framework/framework.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package framework contains tools to enable multiple clients to connect to a // central repository server and run robustness tests concurrently. diff --git a/tests/robustness/multiclient_test/framework/harness.go b/tests/robustness/multiclient_test/framework/harness.go index 684c281e9..1b1631d0f 100644 --- a/tests/robustness/multiclient_test/framework/harness.go +++ b/tests/robustness/multiclient_test/framework/harness.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package framework diff --git a/tests/robustness/multiclient_test/framework/snapshotter.go b/tests/robustness/multiclient_test/framework/snapshotter.go index fd335f5fb..c73e52a30 100644 --- a/tests/robustness/multiclient_test/framework/snapshotter.go +++ b/tests/robustness/multiclient_test/framework/snapshotter.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package framework diff --git a/tests/robustness/multiclient_test/main_test.go b/tests/robustness/multiclient_test/main_test.go index f11c7207c..f6608bee1 100644 --- a/tests/robustness/multiclient_test/main_test.go +++ b/tests/robustness/multiclient_test/main_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package multiclienttest diff --git a/tests/robustness/multiclient_test/multiclient_test.go b/tests/robustness/multiclient_test/multiclient_test.go index 2439c604c..b1b59cbec 100644 --- a/tests/robustness/multiclient_test/multiclient_test.go +++ b/tests/robustness/multiclient_test/multiclient_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package multiclienttest diff --git a/tests/robustness/options.go b/tests/robustness/options.go index 2fc9993f6..7af37e1ed 100644 --- a/tests/robustness/options.go +++ b/tests/robustness/options.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package robustness diff --git a/tests/robustness/persister.go b/tests/robustness/persister.go index e3a22643c..f66382fa7 100644 --- a/tests/robustness/persister.go +++ b/tests/robustness/persister.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package robustness diff --git a/tests/robustness/robustness_test/main_test.go b/tests/robustness/robustness_test/main_test.go index 8a64f9a5b..91043d7c0 100644 --- a/tests/robustness/robustness_test/main_test.go +++ b/tests/robustness/robustness_test/main_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package robustness diff --git a/tests/robustness/robustness_test/robustness_test.go b/tests/robustness/robustness_test/robustness_test.go index b10aa494e..9c8bc7405 100644 --- a/tests/robustness/robustness_test/robustness_test.go +++ b/tests/robustness/robustness_test/robustness_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package robustness diff --git a/tests/robustness/snapmeta/index.go b/tests/robustness/snapmeta/index.go index 1b7fe5f82..a4debcf93 100644 --- a/tests/robustness/snapmeta/index.go +++ b/tests/robustness/snapmeta/index.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta diff --git a/tests/robustness/snapmeta/index_test.go b/tests/robustness/snapmeta/index_test.go index 413cff608..766df5321 100644 --- a/tests/robustness/snapmeta/index_test.go +++ b/tests/robustness/snapmeta/index_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta diff --git a/tests/robustness/snapmeta/kopia_connector.go b/tests/robustness/snapmeta/kopia_connector.go index 29dddadb6..459554f94 100644 --- a/tests/robustness/snapmeta/kopia_connector.go +++ b/tests/robustness/snapmeta/kopia_connector.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta diff --git a/tests/robustness/snapmeta/kopia_connector_test.go b/tests/robustness/snapmeta/kopia_connector_test.go index a1a2833fc..544e44f1c 100644 --- a/tests/robustness/snapmeta/kopia_connector_test.go +++ b/tests/robustness/snapmeta/kopia_connector_test.go @@ -1,10 +1,9 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta import ( - "os" "testing" "github.com/stretchr/testify/assert" @@ -13,7 +12,7 @@ func TestKopiaConnector(t *testing.T) { assert := assert.New(t) // nolint:gocritic - os.Setenv("KOPIA_EXE", "kopia.exe") + t.Setenv("KOPIA_EXE", "kopia.exe") tc := &testConnector{} @@ -33,31 +32,31 @@ func TestKopiaConnector(t *testing.T) { repoPath := "repoPath" bucketName := "bucketName" - os.Setenv(EngineModeEnvKey, EngineModeBasic) - os.Setenv(S3BucketNameEnvKey, "") + t.Setenv(EngineModeEnvKey, EngineModeBasic) + t.Setenv(S3BucketNameEnvKey, "") tc.reset() assert.NoError(tc.connectOrCreateRepo(repoPath)) assert.True(tc.initFilesystemCalled) assert.Equal(repoPath, tc.tcRepoPath) - os.Setenv(EngineModeEnvKey, EngineModeBasic) - os.Setenv(S3BucketNameEnvKey, bucketName) + t.Setenv(EngineModeEnvKey, EngineModeBasic) + t.Setenv(S3BucketNameEnvKey, bucketName) tc.reset() assert.NoError(tc.connectOrCreateRepo(repoPath)) assert.True(tc.initS3Called) assert.Equal(repoPath, tc.tcRepoPath) assert.Equal(bucketName, tc.tcBucketName) - os.Setenv(EngineModeEnvKey, EngineModeServer) - os.Setenv(S3BucketNameEnvKey, "") + t.Setenv(EngineModeEnvKey, EngineModeServer) + t.Setenv(S3BucketNameEnvKey, "") tc.reset() assert.NoError(tc.connectOrCreateRepo(repoPath)) assert.True(tc.initFilesystemWithServerCalled) assert.Equal(repoPath, tc.tcRepoPath) assert.Equal(defaultAddr, tc.tcAddr) - os.Setenv(EngineModeEnvKey, EngineModeServer) - os.Setenv(S3BucketNameEnvKey, bucketName) + t.Setenv(EngineModeEnvKey, EngineModeServer) + t.Setenv(S3BucketNameEnvKey, bucketName) tc.reset() assert.NoError(tc.connectOrCreateRepo(repoPath)) assert.True(tc.initS3WithServerCalled) diff --git a/tests/robustness/snapmeta/kopia_persister.go b/tests/robustness/snapmeta/kopia_persister.go index 4f95fdad7..10b6555a6 100644 --- a/tests/robustness/snapmeta/kopia_persister.go +++ b/tests/robustness/snapmeta/kopia_persister.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package snapmeta provides Kopia implementations of Persister and Snapshotter. package snapmeta diff --git a/tests/robustness/snapmeta/kopia_persister_light.go b/tests/robustness/snapmeta/kopia_persister_light.go index 5ab51694f..fe8a1df1f 100644 --- a/tests/robustness/snapmeta/kopia_persister_light.go +++ b/tests/robustness/snapmeta/kopia_persister_light.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta diff --git a/tests/robustness/snapmeta/kopia_persister_light_test.go b/tests/robustness/snapmeta/kopia_persister_light_test.go index 62e9b68d0..155f06196 100644 --- a/tests/robustness/snapmeta/kopia_persister_light_test.go +++ b/tests/robustness/snapmeta/kopia_persister_light_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta @@ -135,7 +135,7 @@ func TestS3Connect(t *testing.T) { assertNoError(t, err) // Test the S3 code path by attempting to connect to a nonexistent bucket. - os.Setenv(S3BucketNameEnvKey, "does-not-exist") + t.Setenv(S3BucketNameEnvKey, "does-not-exist") kpl, err := NewPersisterLight("") assertNoError(t, err) diff --git a/tests/robustness/snapmeta/kopia_snapshotter.go b/tests/robustness/snapmeta/kopia_snapshotter.go index 644217e43..d5052615a 100644 --- a/tests/robustness/snapmeta/kopia_snapshotter.go +++ b/tests/robustness/snapmeta/kopia_snapshotter.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta @@ -164,11 +164,13 @@ func (ks *KopiaSnapshotter) ConnectOrCreateFilesystem(path string) error { // ConnectOrCreateS3WithServer TBD: remove this. func (ks *KopiaSnapshotter) ConnectOrCreateS3WithServer(serverAddr, bucketName, pathPrefix string) (*exec.Cmd, error) { + // nolint:nilnil return nil, nil } // ConnectOrCreateFilesystemWithServer TBD: remove this. func (ks *KopiaSnapshotter) ConnectOrCreateFilesystemWithServer(serverAddr, repoPath string) (*exec.Cmd, error) { + // nolint:nilnil return nil, nil } diff --git a/tests/robustness/snapmeta/simple.go b/tests/robustness/snapmeta/simple.go index 2b54f808a..c6ecbc870 100644 --- a/tests/robustness/snapmeta/simple.go +++ b/tests/robustness/snapmeta/simple.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta diff --git a/tests/robustness/snapmeta/simple_test.go b/tests/robustness/snapmeta/simple_test.go index b489c8d99..6233cc6c5 100644 --- a/tests/robustness/snapmeta/simple_test.go +++ b/tests/robustness/snapmeta/simple_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package snapmeta diff --git a/tests/robustness/snapshotter.go b/tests/robustness/snapshotter.go index 9bccd86b5..f2a03c7d6 100644 --- a/tests/robustness/snapshotter.go +++ b/tests/robustness/snapshotter.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package robustness contains tests that that validate data stability over time. // The package, while designed for Kopia, is written with abstractions that diff --git a/tests/tools/fswalker/fswalker.go b/tests/tools/fswalker/fswalker.go index 9f3285853..0b47eb80a 100644 --- a/tests/tools/fswalker/fswalker.go +++ b/tests/tools/fswalker/fswalker.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package fswalker provides the checker.Comparer interface using FSWalker // walker and reporter. diff --git a/tests/tools/fswalker/fswalker_test.go b/tests/tools/fswalker/fswalker_test.go index f5aa15333..123c9f2c3 100644 --- a/tests/tools/fswalker/fswalker_test.go +++ b/tests/tools/fswalker/fswalker_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package fswalker diff --git a/tests/tools/fswalker/reporter/reporter.go b/tests/tools/fswalker/reporter/reporter.go index d212f0e75..bb34acc6b 100644 --- a/tests/tools/fswalker/reporter/reporter.go +++ b/tests/tools/fswalker/reporter/reporter.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package reporter wraps calls to the the fswalker Reporter package reporter diff --git a/tests/tools/fswalker/reporter/reporter_test.go b/tests/tools/fswalker/reporter/reporter_test.go index f4c51d567..1d46d7e7d 100644 --- a/tests/tools/fswalker/reporter/reporter_test.go +++ b/tests/tools/fswalker/reporter/reporter_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package reporter diff --git a/tests/tools/fswalker/walker/walker.go b/tests/tools/fswalker/walker/walker.go index 3976c9e18..be782868e 100644 --- a/tests/tools/fswalker/walker/walker.go +++ b/tests/tools/fswalker/walker/walker.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package walker wraps calls to the the fswalker Walker package walker diff --git a/tests/tools/fswalker/walker/walker_test.go b/tests/tools/fswalker/walker/walker_test.go index 91f397314..5ce3dfc5d 100644 --- a/tests/tools/fswalker/walker/walker_test.go +++ b/tests/tools/fswalker/walker/walker_test.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 package walker diff --git a/tests/tools/kopiaclient/kopiaclient.go b/tests/tools/kopiaclient/kopiaclient.go index ad422733e..34c65be02 100644 --- a/tests/tools/kopiaclient/kopiaclient.go +++ b/tests/tools/kopiaclient/kopiaclient.go @@ -1,5 +1,5 @@ -//go:build (darwin && amd64) || (linux && amd64) -// +build darwin,amd64 linux,amd64 +//go:build darwin || (linux && amd64) +// +build darwin linux,amd64 // Package kopiaclient provides a client to interact with a Kopia repo. package kopiaclient diff --git a/tools/gettool/checksums.txt b/tools/gettool/checksums.txt index ad8613093..a7bdb7e4e 100644 --- a/tools/gettool/checksums.txt +++ b/tools/gettool/checksums.txt @@ -2,12 +2,12 @@ https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_ https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-64bit.tar.gz: f9185f6d14eb84d9029d59cdd8a977f2f0be334c4f9d38f2099e56a0c0734731 https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-ARM64.tar.gz: 99a5b4738528d4858a0237199eabc7aee77674c8c7edcfe269efb4b515566cec https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_windows-64bit.zip: 8d79db4f24fbf023c64862c37d09291ac216875dad91e71dd8753cb5883e4274 -https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-darwin-amd64.tar.gz: 9c0042e91218dc1dd4eb7b54e29c7331eff081b3ac3f88b0d5df89b976fcd45c -https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-darwin-arm64.tar.gz: f649893bf2b1d24b2632b5e109884a15f3bf25cfdad46b34fb8fd13a016098fd -https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-linux-amd64.tar.gz: 214b093c15863430c4b66dd39df677dab6e38fc873ded147e331740d50eea51f -https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-linux-arm64.tar.gz: 0fbb58f36933b502bc841f8b28a5c609ac030d3a843fe1ea2dce2cee3a2b0d10 -https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-linux-armv6.tar.gz: 81d5d829dfc93f1123867713d71e0c4e577430aa8833a2b3e7605b0ace79aff8 -https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-windows-amd64.zip: 607d68f0960e3a7b69c73bc0164710dabb4ece06c509afa3584b475194e8d720 +https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-darwin-amd64.tar.gz: 5971ed73d25767b2b955a694e59c7381d56df46e3681a93e067c601d0d6cffad +https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-darwin-arm64.tar.gz: d0c69713b675ee09212273c2136a0d1b30203ddfc1c611a1a4fd5bfa90f9e457 +https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-linux-amd64.tar.gz: f3515cebec926257da703ba0a2b169e4a322c11dc31a8b4656b50a43e48877f4 +https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-linux-arm64.tar.gz: e21c681735faf4efd4086f95d5b49904b0bbbe510dd2058058047a8dbfaee546 +https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-linux-armv6.tar.gz: fb7f6d4d39028570d70f81f42f4eaec2db62efe40d86c01fb9d9666b304372aa +https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-windows-amd64.zip: 5e671027474c2fdc8b5533d492b8373da70f4968724ff10cf4dcbef1d58a2f57 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_arm64.tar.gz: 1f95e6561974f4766d8833438b646b06930563ca9867447ea03edb623d876c75 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_x86_64.tar.gz: 17ecad881a50e32f033da5a200c8417d37cae70f09e925645452937998aca506 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Linux_arm64.tar.gz: 8bf2a9b9e84498bfa239f2fe91b2d555642c87ab9d3f5d37f29e6e97116910a3 diff --git a/tools/tools.mk b/tools/tools.mk index 1dd3aed94..7adb0986e 100644 --- a/tools/tools.mk +++ b/tools/tools.mk @@ -102,7 +102,7 @@ retry:= endif # tool versions -GOLANGCI_LINT_VERSION=1.42.1 +GOLANGCI_LINT_VERSION=1.43.0 NODE_VERSION=16.13.0 HUGO_VERSION=0.89.2 GOTESTSUM_VERSION=1.7.0