You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: set.go
    path of file: ./repos/gapid/gapis/resolve
    
    the code of the file until where you have to start completion: // Copyright (C) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/li
    
func changeResources(ctx context.Context, a arena.Arena, after *path.Command, ids []*path.ID, data []*api.ResourceData, r *path.ResolveConfig) (*path.Capture, error) {
	meta, err := ResourceMeta(ctx, ids, after, r)
	if err != nil {
		return nil, err
	}
	if len(meta.Resources) != len(ids) {
		return nil, fmt.Errorf("Expected %d resource(s), got %d", len(ids), len(meta.Resources))
	}

	cmdIdx := after.Indices[0]
	// If we change resource data, subcommands do not affect this, so change
	// the main command.

	oldCmds, err := NCmds(ctx, after.Capture, cmdIdx+1)
	if err != nil {
		return nil, err
	}

	cmds := make([]api.Cmd, len(oldCmds))
	copy(cmds, oldCmds)

	replaceCommands := func(where uint64, with interface{}) {
		cmds[where] = with.(api.Cmd)
	}

	oldCapt, err := capture.ResolveGraphicsFromPath(ctx, after.Capture)
	if err != nil {
		return nil, err
	}
	var initialState *capture.InitialState
	mutateInitialState := func(API api.API) api.State {
		if initialState == nil {
			if initialState = oldCapt.CloneInitialState(a); initialState == nil {
				return nil
			}
		}
		return initialState.APIs[API]
	}

	for i, resource := range meta.Resources {
		if err := resource.SetResourceData(
			ctx,
			after,
			data[i],
			meta.IDMap,
			replaceCommands,
			mutateInitialState,
			r); err != nil {
			return nil, err
		}
	}

	if initialState == nil {
		initialState = oldCapt.InitialState
	}

	gc, err := capture.NewGraphicsCapture(ctx, a, oldCapt.Name()+"*", oldCapt.Header, initialState, cmds)
	if err != nil {
		return nil, err
	} else {
		return capture.New(ctx, gc)
	}
}