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: reader.go
    path of file: ./repos/sentinel-golang/core/log/metric
    
    the code of the file until where you have to start completion: // Copyright 1999-2020 Alibaba Group Holding Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
/
    
func openFileAndSeekTo(filename string, offset uint64) (*os.File, error) {
	file, err := os.Open(filename)
	if err != nil {
		return nil, errors.Wrap(err, "failed to open file: "+filename)
	}

	// Set position to the offset recorded in the idx file
	_, err = file.Seek(int64(offset), io.SeekStart)
	if err != nil {
		_ = file.Close()
		return nil, errors.Wrapf(err, "failed to fseek to offset %d", offset)
	}
	return file, nil
}