'How can I pass an alias value to a bazel function?

I have the following alias defined in a BUILD file:

alias(
    name = "platform",
    actual = select({
        ":macos_x86_64": "macos_x86_64",
        ":linux_x86_64": "linux_x86_64",
        ":linux_aarch64": "linux_aarch64",
    }),
    visibility = ["//visibility:public"],
)

How can I pass the "actual" string to a function like this?

def myFunction(platform): ...

I am trying the most naive thing and it does not understand that it's an alias, not a string:

myFunction("//bazel/config:platform")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source