def checkBazelTool(name, path, var):
    bazel_tool_abs_path = lookPath(path)
    if bazel_tool_abs_path:
        if (not executableByOthers(bazel_tool_abs_path)):
            error_messages.append('command {} exists, but cannot be executed by other users'.format(path))
    elif pathExists(path):
        if (not executableByOthers(path)):
            error_messages.append('command {} exists, but cannot be executed by other users'.format(path))
    else:
        error_messages.append("Command {} not found. If you have buildifier installed, but the binary name is different or it's not available in $GOPATH/bin, please use {} environment variable to specify the path. Example:\n    export {}=/opt/bin/buildifier\nIf you don't have buildifier installed, you can install it by:\n    go get -u github.com/bazelbuild/buildtools/{}".format(path, var, var, name))
def checkBazelTool(name, path, var):
    bazel_tool_abs_path = lookPath(path)
    if bazel_tool_abs_path:
        if (not executableByOthers(bazel_tool_abs_path)):
            error_messages.append('command {} exists, but cannot be executed by other users'.format(path))
    elif pathExists(path):
        if (not executableByOthers(path)):
            error_messages.append('command {} exists, but cannot be executed by other users'.format(path))
    else:
        error_messages.append("Command {} not found. If you have buildifier installed, but the binary name is different or it's not available in $GOPATH/bin, please use {} environment variable to specify the path. Example:\n    export {}=/opt/bin/buildifier\nIf you don't have buildifier installed, you can install it by:\n    go get -u github.com/bazelbuild/buildtools/{}".format(path, var, var, name))