@@ -162,13 +162,13 @@ type request struct {
162162 preservedDirectory string
163163 Globs []string `json:",omitempty"` // used by stat, get
164164 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
172172}
173173
174174func (req * request ) Excludes () []string {
@@ -248,15 +248,15 @@ func (req *request) GIDMap() []idtools.IDMap {
248248
249249// Response encodes a single response.
250250type 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
260260}
261261
262262// statResponse encodes a response for a single Stat request.
@@ -801,7 +801,7 @@ func copierWithSubprocess(bulkReader io.Reader, bulkWriter io.Writer, req reques
801801 }
802802 loggedOutput := strings .TrimSuffix (errorBuffer .String (), "\n " )
803803 if len (loggedOutput ) > 0 {
804- for _ , output := range strings .Split (loggedOutput , "\n " ) {
804+ for output := range strings .SplitSeq (loggedOutput , "\n " ) {
805805 logrus .Debug (output )
806806 }
807807 }
@@ -1588,8 +1588,8 @@ func mapWithPrefixedKeysWithoutKeyPrefix[K any](m map[string]K, p string) map[st
15881588 }
15891589 cloned := make (map [string ]K , len (m ))
15901590 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
15931593 }
15941594 }
15951595 return cloned
@@ -1819,7 +1819,7 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM
18191819 return fmt .Errorf ("%q is not a subdirectory of %q: %w" , directory , req .Root , err )
18201820 }
18211821 subdir := ""
1822- for _ , component := range strings .Split (rel , string (os .PathSeparator )) {
1822+ for component := range strings .SplitSeq (rel , string (os .PathSeparator )) {
18231823 subdir = filepath .Join (subdir , component )
18241824 path := filepath .Join (req .Root , subdir )
18251825 if err := os .Mkdir (path , 0o700 ); err == nil {
@@ -2187,7 +2187,7 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM
21872187}
21882188
21892189func 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
21912191 return & response {Error : fmt .Sprintf (fmtspec , args ... ), Mkdir : mkdirResponse {}}, nil , nil
21922192 }
21932193 dirUID , dirGID := 0 , 0
@@ -2219,7 +2219,7 @@ func copierHandlerMkdir(req request, idMappings *idtools.IDMappings) (*response,
22192219
22202220 subdir := ""
22212221 var created []string
2222- for _ , component := range strings .Split (rel , string (os .PathSeparator )) {
2222+ for component := range strings .SplitSeq (rel , string (os .PathSeparator )) {
22232223 subdir = filepath .Join (subdir , component )
22242224 path := filepath .Join (req .Root , subdir )
22252225 if err := os .Mkdir (path , 0o700 ); err == nil {
0 commit comments