如何解决“找不到默认凭据”错误

I'm making a program from this link on image detection but while calling a function it will give the error in main main function I call that function function which detect the image that what type of image Is. The program is given below:-

package main
import (
    "bufio"
    "bytes"
    "context"
    "fmt"
    "io"
    "os"

    vision "cloud.google.com/go/vision/apiv1"
)
func init() {
    _ = context.Background()
    _ = vision.ImageAnnotatorClient{}
    _ = os.Open
}
func detectFaces(w io.Writer, file string) error {
    ctx := context.Background()

    client, err := vision.NewImageAnnotatorClient(ctx)
    if err != nil {
        fmt.Println("Hello in function")
        return err
    }

    f, err := os.Open(file)
    if err != nil {
        return err
    }
    defer f.Close()

    image, err := vision.NewImageFromReader(f)
    if err != nil {
        return err
    }
    annotations, err := client.DetectFaces(ctx, image, nil, 10)
    if err != nil {
        return err
    }
    if len(annotations) == 0 {
        fmt.Fprintln(w, "No faces found.")
    } else {
        fmt.Fprintln(w, "Faces:")
        for i, annotation := range annotations {
            fmt.Fprintln(w, "  Face", i)
            fmt.Fprintln(w, "    Anger:", annotation.AngerLikelihood)
            fmt.Fprintln(w, "    Joy:", annotation.JoyLikelihood)
            fmt.Fprintln(w, "    Surprise:", annotation.SurpriseLikelihood)
        }
    }
    return nil
}
func main() {
    var b bytes.Buffer
    writer := bufio.NewWriter(&b)
    err := detectFaces(writer, "aaa.jpg")
    fmt.Println(err)
}

Error is:-

google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

How to solve this error. Can anyone Help me?

Create a project with the Google Cloud Console, and enable the Vision API.

From the Cloud Console, create a service account, download its json credentials file, then set the GOOGLE_APPLICATION_CREDENTIALS environment variable:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json