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
This commit is contained in:
Jarek Kowalski
2021-11-11 17:03:11 -08:00
committed by GitHub
parent 3336a02bab
commit 8a4ac4dec3
62 changed files with 159 additions and 158 deletions

View File

@@ -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

View File

@@ -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 .

View File

@@ -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{

View File

@@ -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")
}

View File

@@ -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)
}

View File

@@ -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),

View File

@@ -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

View File

@@ -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")
}

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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()
}

View File

@@ -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()
}

View File

@@ -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 (

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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")
}

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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,
}

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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