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: apk_constraint.go
    path of file: ./repos/grype/grype/version
    
    the code of the file until where you have to start completion: //nolint:dupl
package version

import "fmt"

type apkConstraint str
    
func (c apkConstraint) Satisfied(version *Version) (bool, error) {
	if c.raw == "" && version != nil {
		// empty constraints are always satisfied
		return true, nil
	}

	if version == nil {
		if c.raw != "" {
			// a non-empty constraint with no version given should always fail
			return false, nil
		}

		return true, nil
	}

	if !c.supported(version.Format) {
		return false, fmt.Errorf("(apk) unsupported format: %s", version.Format)
	}

	if version.rich.apkVer == nil {
		return false, fmt.Errorf("no rich apk version given: %+v", version)
	}

	return c.expression.satisfied(version)
}