Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

go fmt

Chris Lu0ea5c087ce84
diff --git a/weed/filer/filer_conf.go b/weed/filer/filer_conf.go
index 0a86192ecc..b75fb50846 100644
--- a/weed/filer/filer_conf.go
+++ b/weed/filer/filer_conf.go
@@ -10,9 +10,8 @@ import (
"github.com/viant/ptrie"
)
-
const (
- DirectoryEtc = "/etc"
+ DirectoryEtc = "/etc"
FilerConfName = "filer.conf"
)
@@ -27,7 +26,7 @@ func NewFilerConf() (fc *FilerConf) {
return fc
}
-func (fc *FilerConf) loadFromFiler(filer *Filer) (err error){
+func (fc *FilerConf) loadFromFiler(filer *Filer) (err error) {
filerConfPath := util.NewFullPath(DirectoryEtc, FilerConfName)
entry, err := filer.FindEntry(context.Background(), filerConfPath)
if err != nil {
@@ -79,7 +78,7 @@ var (
EmptyFilerConfPathConf = &filer_pb.FilerConf_PathConf{}
)
-func (fc *FilerConf) MatchStorageRule(path string) (pathConf *filer_pb.FilerConf_PathConf){
+func (fc *FilerConf) MatchStorageRule(path string) (pathConf *filer_pb.FilerConf_PathConf) {
fc.rules.MatchPrefix([]byte(path), func(key []byte, value interface{}) bool {
pathConf = value.(*filer_pb.FilerConf_PathConf)
return true
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 9e13423707..3bffa156e8 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -294,7 +294,7 @@ func (file *File) addChunks(chunks []*filer_pb.FileChunk) {
// find the earliest incoming chunk
newChunks := chunks
earliestChunk := newChunks[0]
- for i:=1;i<len(newChunks);i++{
+ for i := 1; i < len(newChunks); i++ {
if lessThan(earliestChunk, newChunks[i]) {
earliestChunk = newChunks[i]
}
diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.go
index c58d3a84d0..16ad04476e 100644
--- a/weed/operation/assign_file_id.go
+++ b/weed/operation/assign_file_id.go
@@ -137,4 +137,3 @@ func (so *StorageOption) ToAssignRequests(count int) (ar *VolumeAssignRequest, a
}
return
}
-
diff --git a/weed/pb/filer_pb/filer_pb_helper.go b/weed/pb/filer_pb/filer_pb_helper.go
index fb989a02ee..8dde9c80c7 100644
--- a/weed/pb/filer_pb/filer_pb_helper.go
+++ b/weed/pb/filer_pb/filer_pb_helper.go
@@ -141,6 +141,7 @@ func IsRename(event *SubscribeMetadataResponse) bool {
}
var _ = ptrie.KeyProvider(&FilerConf_PathConf{})
+
func (fp *FilerConf_PathConf) Key() interface{} {
return fp.LocationPrefix
}
diff --git a/weed/s3api/http/header.go b/weed/s3api/http/header.go
index f496429fc4..a960d23702 100644
--- a/weed/s3api/http/header.go
+++ b/weed/s3api/http/header.go
@@ -32,5 +32,5 @@ const (
// Non-Standard S3 HTTP request constants
const (
AmzIdentityId = "x-amz-identity-id"
- AmzIsAdmin = "x-amz-is-admin" // only set to http request header as a context
+ AmzIsAdmin = "x-amz-is-admin" // only set to http request header as a context
)
diff --git a/weed/server/filer_server_handlers.go b/weed/server/filer_server_handlers.go
index a64b239271..451e2a2deb 100644
--- a/weed/server/filer_server_handlers.go
+++ b/weed/server/filer_server_handlers.go
@@ -27,7 +27,7 @@ func (fs *FilerServer) filerHandler(w http.ResponseWriter, r *http.Request) {
case "DELETE":
stats.FilerRequestCounter.WithLabelValues("delete").Inc()
if _, ok := r.URL.Query()["tagging"]; ok {
- fs.DeleteTaggingHandler(w,r)
+ fs.DeleteTaggingHandler(w, r)
} else {
fs.DeleteHandler(w, r)
}
@@ -35,7 +35,7 @@ func (fs *FilerServer) filerHandler(w http.ResponseWriter, r *http.Request) {
case "PUT":
stats.FilerRequestCounter.WithLabelValues("put").Inc()
if _, ok := r.URL.Query()["tagging"]; ok {
- fs.PutTaggingHandler(w,r)
+ fs.PutTaggingHandler(w, r)
} else {
fs.PostHandler(w, r)
}
diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go
index 0344d84dc4..5806b0c1f8 100644
--- a/weed/server/filer_server_handlers_write.go
+++ b/weed/server/filer_server_handlers_write.go
@@ -103,7 +103,7 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNoContent)
}
-func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication string, ttlSeconds int32, dataCenter, rack string) (*operation.StorageOption) {
+func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication string, ttlSeconds int32, dataCenter, rack string) *operation.StorageOption {
collection := util.Nvl(qCollection, fs.option.Collection)
replication := util.Nvl(qReplication, fs.option.DefaultReplication)
@@ -131,7 +131,7 @@ func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication
if err != nil {
glog.Errorf("fail to parse %s ttl setting %s: %v", rule.LocationPrefix, rule.Ttl, err)
}
- ttlSeconds = int32(ttl.Minutes())*60
+ ttlSeconds = int32(ttl.Minutes()) * 60
}
return &operation.StorageOption{
@@ -144,7 +144,7 @@ func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication
}
}
-func (fs *FilerServer) detectStorageOption0(requestURI, qCollection, qReplication string, qTtl string, dataCenter, rack string) (*operation.StorageOption) {
+func (fs *FilerServer) detectStorageOption0(requestURI, qCollection, qReplication string, qTtl string, dataCenter, rack string) *operation.StorageOption {
ttl, err := needle.ReadTTL(qTtl)
if err != nil {