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: load.go
    path of file: ./repos/podman/vendor/github.com/sylabs/sif/v2/pkg/sif
    
    the code of the file until where you have to start completion: // Copyright (c) 2018-2021, Sylabs Inc. All rights reserved.
// Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
// Copyright (c) 2017, Yannick Cote <yhcote@gmail.com> All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE fi
    
func loadContainer(rw ReadWriter) (*FileImage, error) {
	f := FileImage{rw: rw}

	// Read global header.
	err := binary.Read(
		io.NewSectionReader(rw, 0, int64(binary.Size(f.h))),
		binary.LittleEndian,
		&f.h,
	)
	if err != nil {
		return nil, fmt.Errorf("reading global header: %w", err)
	}

	if err := isValidSif(&f); err != nil {
		return nil, err
	}

	// Read descriptors.
	f.rds = make([]rawDescriptor, f.h.DescriptorsTotal)
	err = binary.Read(
		io.NewSectionReader(rw, f.h.DescriptorsOffset, f.h.DescriptorsSize),
		binary.LittleEndian,
		&f.rds,
	)
	if err != nil {
		return nil, fmt.Errorf("reading descriptors: %w", err)
	}

	f.populateMinIDs()

	return &f, nil
}