From 647f111b4875a568fef41993d535cb16a1cfb60d Mon Sep 17 00:00:00 2001 From: Joonas Loppi Date: Mon, 10 Apr 2023 18:49:42 +0300 Subject: [PATCH] `$ gofmt` changes in updated Go version --- pkg/blorm/interface.go | 3 ++- pkg/mutexmap/mutexmap.go | 3 ++- pkg/smart/smart.go | 7 ++++--- pkg/stofuse/collectionadapter.go | 7 ++++--- pkg/stoserver/health.go | 8 ++++---- pkg/stoserver/restapi.go | 3 ++- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/pkg/blorm/interface.go b/pkg/blorm/interface.go index b3be15ff..289e8d76 100644 --- a/pkg/blorm/interface.go +++ b/pkg/blorm/interface.go @@ -2,7 +2,8 @@ // this was born because: https://github.com/asdine/storm/issues/222#issuecomment-472791001 // // Warning: don't Each() and Delete() at the same time. Deletion messes with the iteration -// order somehow, and I observed half of the records was deleted when I tried to delete all. +// +// order somehow, and I observed half of the records was deleted when I tried to delete all. package blorm import ( diff --git a/pkg/mutexmap/mutexmap.go b/pkg/mutexmap/mutexmap.go index 667758ba..a06053be 100644 --- a/pkg/mutexmap/mutexmap.go +++ b/pkg/mutexmap/mutexmap.go @@ -9,7 +9,8 @@ import ( // When you TryLock(): // a) it won't open if it's already occupied. (because it's locked inside) decide to do something else // b) it opens and you get in and the stall gets reserved/locked for you. When you get out -// you call the unlock callback you obtained from TryLock() to return the stall for use. +// +// you call the unlock callback you obtained from TryLock() to return the stall for use. type M struct { // value is chan that Lock() can use to listen for unlock event (close of channel) locks map[string]chan bool diff --git a/pkg/smart/smart.go b/pkg/smart/smart.go index f79cfc6b..e18b0ca1 100644 --- a/pkg/smart/smart.go +++ b/pkg/smart/smart.go @@ -25,10 +25,11 @@ func SmartCtlBackend(device string) ([]byte, error) { return stdout, silenceSmartCtlAutomationHostileErrors(err) } -/* joonas/smartmontools built from simple Dockerfile: +/* +joonas/smartmontools built from simple Dockerfile: - FROM alpine:edge - RUN apk add --update smartmontools +FROM alpine:edge +RUN apk add --update smartmontools */ func SmartCtlViaDockerBackend(device string) ([]byte, error) { // disks in /dev are visible without --privileged (by mapping /dev:/dev) but diff --git a/pkg/stofuse/collectionadapter.go b/pkg/stofuse/collectionadapter.go index af1d144d..437b4a82 100644 --- a/pkg/stofuse/collectionadapter.go +++ b/pkg/stofuse/collectionadapter.go @@ -499,10 +499,11 @@ func (a *changedFileInWorkdir) Open(ctx context.Context, req *fuse.OpenRequest, return &changedFileInWorkdirHandle{hdl}, nil } -/* To test +/* +To test - $ apt install -y attr - $ setfattr -n user.foo -v hihi foobar.txt +$ apt install -y attr +$ setfattr -n user.foo -v hihi foobar.txt */ func (a *changedFileInWorkdir) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error { log.Printf("Listxattr %s", a.backingFilePath) diff --git a/pkg/stoserver/health.go b/pkg/stoserver/health.go index 86ad0027..ec8a1d19 100644 --- a/pkg/stoserver/health.go +++ b/pkg/stoserver/health.go @@ -55,10 +55,10 @@ func healthForScheduledJobs(tx *bbolt.Tx) stohealth.HealthChecker { } /* - <=5 freezing (fail) - 5-45 => ok (pass) - 45-50 => uncomfortable (warn) - >=50 => too hot (fail) +<=5 freezing (fail) +5-45 => ok (pass) +45-50 => uncomfortable (warn) +>=50 => too hot (fail) */ func temperatureToHealthStatus(tempC int) stoservertypes.HealthStatus { switch { diff --git a/pkg/stoserver/restapi.go b/pkg/stoserver/restapi.go index 6d4947c0..310de417 100644 --- a/pkg/stoserver/restapi.go +++ b/pkg/stoserver/restapi.go @@ -982,7 +982,8 @@ func (h *handlers) DatabaseExportSha256s(rctx *httpauth.RequestContext, w http.R // robustness of the metadata database. that's why we have this export endpoint - to get // backups. more confidence will come when this whole system is hooked up to Event Horizon. // Run this with: -// $ curl -H "Authorization: Bearer $BUP_AUTHTOKEN" https://localhost/api/db/export +// +// $ curl -H "Authorization: Bearer $BUP_AUTHTOKEN" https://localhost/api/db/export func (h *handlers) DatabaseExport(rctx *httpauth.RequestContext, w http.ResponseWriter, r *http.Request) { tx, err := h.db.Begin(false) panicIfError(err)