mirror of
https://github.com/versity/versitygw.git
synced 2026-08-21 14:46:19 +00:00
chore: run go modernize tool
This is a fixup of the codebase using: go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -fix ./... This has no bahvior changes, and only updates safe changes for modern go features.
This commit is contained in:
@@ -22,12 +22,7 @@ func (c *PayloadChunked) getChunkedPayloadContentLength(additionalChunkHeaderSiz
|
||||
var sizeIdx int64
|
||||
var contentLength int64
|
||||
for sizeIdx = 0; sizeIdx < payloadSize; sizeIdx += c.chunkSize {
|
||||
var endIdx int64
|
||||
if sizeIdx+c.chunkSize < payloadSize {
|
||||
endIdx = sizeIdx + c.chunkSize
|
||||
} else {
|
||||
endIdx = payloadSize
|
||||
}
|
||||
endIdx := min(sizeIdx+c.chunkSize, payloadSize)
|
||||
hexSize := fmt.Sprintf("%x", endIdx-sizeIdx)
|
||||
contentLength += int64(len(hexSize)) + additionalChunkHeaderSize + (endIdx - sizeIdx) + 2
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ func NewPutBucketCORSCommand(command *S3Command, ruleStrings []string) (*S3Comma
|
||||
|
||||
func assembleCORSRule(ruleString string) (*CORSRule, error) {
|
||||
corsRule := &CORSRule{}
|
||||
ruleComponents := strings.Split(ruleString, ";")
|
||||
for _, component := range ruleComponents {
|
||||
ruleComponents := strings.SplitSeq(ruleString, ";")
|
||||
for component := range ruleComponents {
|
||||
componentSegments := strings.Split(component, "=")
|
||||
switch componentSegments[0] {
|
||||
case AllowedMethods:
|
||||
|
||||
@@ -77,8 +77,8 @@ func (r *restParams) String() string {
|
||||
|
||||
func (r *restParams) Set(value string) error {
|
||||
*r = make(map[string]string)
|
||||
pairs := strings.Split(value, *paramSeparator)
|
||||
for _, pair := range pairs {
|
||||
pairs := strings.SplitSeq(value, *paramSeparator)
|
||||
for pair := range pairs {
|
||||
kv := strings.SplitN(pair, ":", 2)
|
||||
if len(kv) != 2 {
|
||||
return fmt.Errorf("invalid key-value pair: %s", pair)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
var Debug *bool
|
||||
var LogFile *string
|
||||
|
||||
func PrintDebug(format string, args ...interface{}) {
|
||||
func PrintDebug(format string, args ...any) {
|
||||
if *Debug {
|
||||
if *LogFile != "" {
|
||||
logFile, err := os.OpenFile(*LogFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
|
||||
@@ -22,7 +22,7 @@ func PrintDebug(format string, args ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func LogFatal(format string, args ...interface{}) {
|
||||
func LogFatal(format string, args ...any) {
|
||||
PrintDebug(format, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user