Go + Azure:调用方法返回未定义

Am trying to use Go Azure SDK to call the notification hub api

I have installed the SDK and imported to the GO file :

package hub

import (

    "fmt"

    "github.com/Azure/azure-sdk-for-go/arm/notificationhubs"
)

func GetHub() {
    if resourceType, err := notificationhubs.Get("sourceGroupName", "NameSpaceValue", "NameOfTheHub"); err != nil {
        fmt.Println("Error occured")
        return
    }
    fmt.Println("Success")

}

However when am trying to runt he code i got this error

undefined: notificationhubs.Get

And am not sure what it means since my IDE don't complain about importing the Azure SDK so am assuming the SDK is imported correctly.

The function you're trying to use doesn't exist (https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/notificationhubs).

You're probably trying to use the function GroupClient.Get; if that's the case, you need to get an object of type GroupClient and then call the function Get on it.

@cd1 is correct! The Get method doesn't belong directly to namespace that you've imported, but rather a client that exists in that namespace. In order to interact with NotificationsHub in this manner, instantiate a GroupClient then run a Get command.

import (
    hubs "github.com/Azure/azure-sdk-for-go/arm/notificationshub"
)

func main() {
    // Implementation details of your program ...
    client := hubs.NewGroupClient("<YOUR SUBSCRIPTION ID>")
    client.Authorizer = // Your initialized Service Principal Token

    results, err := client.Get("<RESOURCE GROUP NAME>", "<NAMESPACE NAME>", "<NOTIFICATION HUB NAME>")
    if err != nil {
        return
    }
}