From f414db987dd4050a8a1ea02ecfc74baf047bed25 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 19 Aug 2022 19:12:26 +0200 Subject: [PATCH] gofmt all files Apparently the rules for comment formatting have changed with go 1.19. --- cmd/restic/cmd_check.go | 8 +++---- cmd/restic/secondary_repo_test.go | 2 +- doc.go | 2 +- internal/backend/gs/gs.go | 8 +++---- internal/backend/sftp/config.go | 6 +++--- internal/backend/test/doc.go | 35 ++++++++++++++++--------------- internal/repository/doc.go | 7 +++---- internal/restic/snapshot.go | 6 +++--- internal/restorer/doc.go | 8 +++---- internal/restorer/fileswriter.go | 2 +- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index 60c4e19c5..80b92862d 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -148,10 +148,10 @@ func parsePercentage(s string) (float64, error) { // prepareCheckCache configures a special cache directory for check. // -// * if --with-cache is specified, the default cache is used -// * if the user explicitly requested --no-cache, we don't use any cache -// * if the user provides --cache-dir, we use a cache in a temporary sub-directory of the specified directory and the sub-directory is deleted after the check -// * by default, we use a cache in a temporary directory that is deleted after the check +// - if --with-cache is specified, the default cache is used +// - if the user explicitly requested --no-cache, we don't use any cache +// - if the user provides --cache-dir, we use a cache in a temporary sub-directory of the specified directory and the sub-directory is deleted after the check +// - by default, we use a cache in a temporary directory that is deleted after the check func prepareCheckCache(opts CheckOptions, gopts *GlobalOptions) (cleanup func()) { cleanup = func() {} if opts.WithCache { diff --git a/cmd/restic/secondary_repo_test.go b/cmd/restic/secondary_repo_test.go index 0c657ae69..cb410f1b9 100644 --- a/cmd/restic/secondary_repo_test.go +++ b/cmd/restic/secondary_repo_test.go @@ -8,7 +8,7 @@ import ( rtest "github.com/restic/restic/internal/test" ) -//TestFillSecondaryGlobalOpts tests valid and invalid data on fillSecondaryGlobalOpts-function +// TestFillSecondaryGlobalOpts tests valid and invalid data on fillSecondaryGlobalOpts-function func TestFillSecondaryGlobalOpts(t *testing.T) { //secondaryRepoTestCase defines a struct for test cases type secondaryRepoTestCase struct { diff --git a/doc.go b/doc.go index ff0a0796f..31527a78d 100644 --- a/doc.go +++ b/doc.go @@ -1,6 +1,6 @@ // Package restic gives a (very brief) introduction to the structure of source code. // -// Overview +// # Overview // // The packages are structured so that cmd/ contains the main package for the // restic binary, and internal/ contains almost all code in library form. We've diff --git a/internal/backend/gs/gs.go b/internal/backend/gs/gs.go index 5e464ab32..3c68b55e7 100644 --- a/internal/backend/gs/gs.go +++ b/internal/backend/gs/gs.go @@ -28,10 +28,10 @@ import ( // Backend stores data in a GCS bucket. // // The service account used to access the bucket must have these permissions: -// * storage.objects.create -// * storage.objects.delete -// * storage.objects.get -// * storage.objects.list +// - storage.objects.create +// - storage.objects.delete +// - storage.objects.get +// - storage.objects.list type Backend struct { gcsClient *storage.Client projectID string diff --git a/internal/backend/sftp/config.go b/internal/backend/sftp/config.go index 3b3d622a0..ec38ee467 100644 --- a/internal/backend/sftp/config.go +++ b/internal/backend/sftp/config.go @@ -32,9 +32,9 @@ func init() { // ParseConfig parses the string s and extracts the sftp config. The // supported configuration formats are sftp://user@host[:port]/directory -// and sftp:user@host:directory. The directory will be path Cleaned and can -// be an absolute path if it starts with a '/' (e.g. -// sftp://user@host//absolute and sftp:user@host:/absolute). +// and sftp:user@host:directory. The directory will be path Cleaned and can +// be an absolute path if it starts with a '/' (e.g. +// sftp://user@host//absolute and sftp:user@host:/absolute). func ParseConfig(s string) (interface{}, error) { var user, host, port, dir string switch { diff --git a/internal/backend/test/doc.go b/internal/backend/test/doc.go index c1704d2c9..25bdf0417 100644 --- a/internal/backend/test/doc.go +++ b/internal/backend/test/doc.go @@ -1,6 +1,6 @@ // Package test contains a test suite with benchmarks for restic backends. // -// Overview +// # Overview // // For the test suite to work a few functions need to be implemented to create // new config, create a backend, open it and run cleanup tasks afterwards. The @@ -10,30 +10,31 @@ // then the methods RunTests() and RunBenchmarks() can be used to run the // individual tests and benchmarks as subtests/subbenchmarks. // -// Example +// # Example // // Assuming a *Suite is returned by newTestSuite(), the tests and benchmarks // can be run like this: -// func newTestSuite(t testing.TB) *test.Suite { -// return &test.Suite{ -// Create: func(cfg interface{}) (restic.Backend, error) { -// [...] -// }, -// [...] -// } -// } // -// func TestSuiteBackendMem(t *testing.T) { -// newTestSuite(t).RunTests(t) -// } +// func newTestSuite(t testing.TB) *test.Suite { +// return &test.Suite{ +// Create: func(cfg interface{}) (restic.Backend, error) { +// [...] +// }, +// [...] +// } +// } // -// func BenchmarkSuiteBackendMem(b *testing.B) { -// newTestSuite(b).RunBenchmarks(b) -// } +// func TestSuiteBackendMem(t *testing.T) { +// newTestSuite(t).RunTests(t) +// } +// +// func BenchmarkSuiteBackendMem(b *testing.B) { +// newTestSuite(b).RunBenchmarks(b) +// } // // The functions are run in alphabetical order. // -// Add new tests +// # Add new tests // // A new test or benchmark can be added by implementing a method on *Suite // with the name starting with "Test" and a single *testing.T parameter for diff --git a/internal/repository/doc.go b/internal/repository/doc.go index cb98334c4..9e5a2c2bc 100644 --- a/internal/repository/doc.go +++ b/internal/repository/doc.go @@ -2,7 +2,7 @@ // the following the abstractions used for this package are listed. More // information can be found in the restic design document. // -// File +// # File // // A file is a named handle for some data saved in the backend. For the local // backend, this corresponds to actual files saved to disk. Usually, the SHA256 @@ -11,18 +11,17 @@ // encrypted before being saved in a backend. This means that the name is the // hash of the ciphertext. // -// Blob +// # Blob // // A blob is a number of bytes that has a type (data or tree). Blobs are // identified by an ID, which is the SHA256 hash of the blobs' contents. One or // more blobs are bundled together in a Pack and then saved to the backend. // Blobs are always encrypted before being bundled in a Pack. // -// Pack +// # Pack // // A Pack is a File in the backend that contains one or more (encrypted) blobs, // followed by a header at the end of the Pack. The header is encrypted and // contains the ID, type, length and offset for each blob contained in the // Pack. -// package repository diff --git a/internal/restic/snapshot.go b/internal/restic/snapshot.go index b12548459..10c4f218e 100644 --- a/internal/restic/snapshot.go +++ b/internal/restic/snapshot.go @@ -217,9 +217,9 @@ func (sn *Snapshot) HasTags(l []string) bool { } // HasTagList returns true if either -// - the snapshot satisfies at least one TagList, so there is a TagList in l -// for which all tags are included in sn, or -// - l is empty +// - the snapshot satisfies at least one TagList, so there is a TagList in l +// for which all tags are included in sn, or +// - l is empty func (sn *Snapshot) HasTagList(l []TagList) bool { debug.Log("testing snapshot with tags %v against list: %v", sn.Tags, l) diff --git a/internal/restorer/doc.go b/internal/restorer/doc.go index 680e30c90..e230f23f0 100644 --- a/internal/restorer/doc.go +++ b/internal/restorer/doc.go @@ -8,10 +8,10 @@ // Here is high-level pseudo-code of how the Restorer attempts to achieve // these goals: // -// while there are packs to process -// choose a pack to process [1] -// retrieve the pack from the backend [2] -// write pack blobs to the files that need them [3] +// while there are packs to process +// choose a pack to process [1] +// retrieve the pack from the backend [2] +// write pack blobs to the files that need them [3] // // Retrieval of repository packs (step [2]) and writing target files (step [3]) // are performed concurrently on multiple goroutines. diff --git a/internal/restorer/fileswriter.go b/internal/restorer/fileswriter.go index 542a15f02..8b7ee4353 100644 --- a/internal/restorer/fileswriter.go +++ b/internal/restorer/fileswriter.go @@ -12,7 +12,7 @@ import ( // multiple files can be written to concurrently. // multiple blobs can be concurrently written to the same file. // TODO I am not 100% convinced this is necessary, i.e. it may be okay -// to use multiple os.File to write to the same target file +// to use multiple os.File to write to the same target file type filesWriter struct { buckets []filesWriterBucket }