@@ -162,13 +162,13 @@ type request struct {
162
162
preservedDirectory string
163
163
Globs []string `json:",omitempty"` // used by stat, get
164
164
preservedGlobs []string
165
- StatOptions StatOptions `json:",omitempty"`
166
- GetOptions GetOptions `json:",omitempty"`
167
- PutOptions PutOptions `json:",omitempty"`
168
- MkdirOptions MkdirOptions `json:",omitempty"`
169
- RemoveOptions RemoveOptions `json:",omitempty"`
170
- EnsureOptions EnsureOptions `json:",omitempty"`
171
- ConditionalRemoveOptions ConditionalRemoveOptions `json:",omitempty"`
165
+ StatOptions StatOptions
166
+ GetOptions GetOptions
167
+ PutOptions PutOptions
168
+ MkdirOptions MkdirOptions
169
+ RemoveOptions RemoveOptions
170
+ EnsureOptions EnsureOptions
171
+ ConditionalRemoveOptions ConditionalRemoveOptions
172
172
}
173
173
174
174
func (req * request ) Excludes () []string {
@@ -248,15 +248,15 @@ func (req *request) GIDMap() []idtools.IDMap {
248
248
249
249
// Response encodes a single response.
250
250
type response struct {
251
- Error string `json:",omitempty"`
252
- Stat statResponse `json:",omitempty"`
253
- Eval evalResponse `json:",omitempty"`
254
- Get getResponse `json:",omitempty"`
255
- Put putResponse `json:",omitempty"`
256
- Mkdir mkdirResponse `json:",omitempty"`
257
- Remove removeResponse `json:",omitempty"`
258
- Ensure ensureResponse `json:",omitempty"`
259
- ConditionalRemove conditionalRemoveResponse `json:",omitempty"`
251
+ Error string `json:",omitempty"`
252
+ Stat statResponse
253
+ Eval evalResponse
254
+ Get getResponse
255
+ Put putResponse
256
+ Mkdir mkdirResponse
257
+ Remove removeResponse
258
+ Ensure ensureResponse
259
+ ConditionalRemove conditionalRemoveResponse
260
260
}
261
261
262
262
// statResponse encodes a response for a single Stat request.
@@ -801,7 +801,7 @@ func copierWithSubprocess(bulkReader io.Reader, bulkWriter io.Writer, req reques
801
801
}
802
802
loggedOutput := strings .TrimSuffix (errorBuffer .String (), "\n " )
803
803
if len (loggedOutput ) > 0 {
804
- for _ , output := range strings .Split (loggedOutput , "\n " ) {
804
+ for output := range strings .SplitSeq (loggedOutput , "\n " ) {
805
805
logrus .Debug (output )
806
806
}
807
807
}
@@ -1588,8 +1588,8 @@ func mapWithPrefixedKeysWithoutKeyPrefix[K any](m map[string]K, p string) map[st
1588
1588
}
1589
1589
cloned := make (map [string ]K , len (m ))
1590
1590
for k , v := range m {
1591
- if strings .HasPrefix (k , p ) {
1592
- cloned [strings . TrimPrefix ( k , p ) ] = v
1591
+ if after , ok := strings .CutPrefix (k , p ); ok {
1592
+ cloned [after ] = v
1593
1593
}
1594
1594
}
1595
1595
return cloned
@@ -1819,7 +1819,7 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM
1819
1819
return fmt .Errorf ("%q is not a subdirectory of %q: %w" , directory , req .Root , err )
1820
1820
}
1821
1821
subdir := ""
1822
- for _ , component := range strings .Split (rel , string (os .PathSeparator )) {
1822
+ for component := range strings .SplitSeq (rel , string (os .PathSeparator )) {
1823
1823
subdir = filepath .Join (subdir , component )
1824
1824
path := filepath .Join (req .Root , subdir )
1825
1825
if err := os .Mkdir (path , 0o700 ); err == nil {
@@ -2187,7 +2187,7 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM
2187
2187
}
2188
2188
2189
2189
func copierHandlerMkdir (req request , idMappings * idtools.IDMappings ) (* response , func () error , error ) {
2190
- errorResponse := func (fmtspec string , args ... any ) (* response , func () error , error ) {
2190
+ errorResponse := func (fmtspec string , args ... any ) (* response , func () error , error ) { //nolint:unparam
2191
2191
return & response {Error : fmt .Sprintf (fmtspec , args ... ), Mkdir : mkdirResponse {}}, nil , nil
2192
2192
}
2193
2193
dirUID , dirGID := 0 , 0
@@ -2219,7 +2219,7 @@ func copierHandlerMkdir(req request, idMappings *idtools.IDMappings) (*response,
2219
2219
2220
2220
subdir := ""
2221
2221
var created []string
2222
- for _ , component := range strings .Split (rel , string (os .PathSeparator )) {
2222
+ for component := range strings .SplitSeq (rel , string (os .PathSeparator )) {
2223
2223
subdir = filepath .Join (subdir , component )
2224
2224
path := filepath .Join (req .Root , subdir )
2225
2225
if err := os .Mkdir (path , 0o700 ); err == nil {
0 commit comments