async def METHOD_NAME(field_set: GoBinaryFieldSet) -> BuiltPackage:
    main_pkg, build_opts = await MultiGet(
        Get(GoBinaryMainPackage, GoBinaryMainPackageRequest(field_set.main)),
        Get(GoBuildOptions, GoBuildOptionsFromTargetRequest(field_set.address)),
    )
    if main_pkg.is_third_party:
        assert isinstance(main_pkg.import_path, str)
        go_mod_address = main_pkg.address.maybe_convert_to_target_generator()
        go_mod_info = await Get(GoModInfo, GoModInfoRequest(go_mod_address))
        analysis = await Get(
            ThirdPartyPkgAnalysis,
            ThirdPartyPkgAnalysisRequest(
                main_pkg.import_path,
                go_mod_address,
                go_mod_info.digest,
                go_mod_info.mod_path,
                build_opts=build_opts,
            ),
        )
        package_name = analysis.name
    else:
        main_pkg_analysis = await Get(
            FallibleFirstPartyPkgAnalysis,
            FirstPartyPkgAnalysisRequest(main_pkg.address, build_opts=build_opts),
        )
        if not main_pkg_analysis.analysis:
            raise ValueError(
                f"Unable to analyze main package `{main_pkg.address}` for go_binary target {field_set.address}: {main_pkg_analysis.stderr}"
            )
        package_name = main_pkg_analysis.analysis.name
    if package_name != "main":
        raise ValueError(
            f"{GoThirdPartyPackageTarget.alias if main_pkg.is_third_party else GoPackageTarget.alias} "
            f"target `{main_pkg.address}` is used as the main package for {GoBinaryTarget.alias} target "
            f"`{field_set.address}` but uses package name `{package_name}` instead of `main`. Go "
            "requires that main packages actually use `main` as the package name."
        )
    built_package = await Get(
        BuiltGoPackage,
        BuildGoPackageTargetRequest(main_pkg.address, is_main=True, build_opts=build_opts),
    )
    main_pkg_a_file_path = built_package.import_paths_to_pkg_a_files["main"]
    output_filename = PurePath(field_set.output_path.value_or_default(file_ending=None))
    binary = await Get(
        LinkedGoBinary,
        LinkGoBinaryRequest(
            input_digest=built_package.digest,
            archives=(main_pkg_a_file_path,),
            build_opts=build_opts,
            import_paths_to_pkg_a_files=FrozenDict(built_package.import_paths_to_pkg_a_files),
            output_filename=f"./{output_filename.name}",
            description=f"Link Go binary for {field_set.address}",
        ),
    )
    renamed_output_digest = await Get(Digest, AddPrefix(binary.digest, str(output_filename.parent)))
    artifact = BuiltPackageArtifact(relpath=str(output_filename))
    return BuiltPackage(renamed_output_digest, (artifact,))