Implement the functionality for the FileOpsCollection struct in the Go package /app/pathfileops. Specifically, you need to implement the following methods:
DeleteAtIndex(index int) error: This method should remove a file operation at the specified index from the fileOps collection.
If the index is invalid (negative or greater than the length of the array), return an appropriate error.
The method should adjust the internal array to ensure that after an operation is removed, all subsequent elements shift down to fill the gap.
GetNumOfFileOps() int: This method should return the current number of file operations in the fileOps collection.
PeekFileOpsAtIndex(index int) (*FileOps, error): This method should return the file operation at the specified index without removing it from the collection. If the index is invalid, return an appropriate error.
Ensure that the fileOps collection can handle these methods gracefully when it is empty.
Requirements
Your implementation must successfully pass all the provided unit tests, especially those focusing on the DeleteAtIndex, GetNumOfFileOps, and PeekFileOpsAtIndex methods.
Handle edge cases:
Attempting to delete or peek at an index that is out of bounds should return an error.
When the collection is empty, ensure that attempts to get or delete operations also properly return an error.
Make sure to structure your code within the /app/ directory and follow best practices for Go code organization. Implement any helper functions or types as necessary to make the implementation clean and efficient.
Important: declare your solution in package pathfileops (the test file uses package pathfileops, so the implementation must use the matching package name).