Golang invalid indirect

invalid indirect of oauth.RequestToken literal (type oauth.RequestToken)

Why is the following line invalid?

func (s *Service) Callback(r *http.Request, req *RequestOauth, resp *Response) error {
    c := endpoints.NewContext(r)
    ====>requestToken := *oauth.RequestToken{Token:req.Oauth_token, Secret:""}<======
    b, err := TwitterApi(requestToken, req.Oauth_verifier)
    return err

func TwitterApi(requestToken *oauth.RequestToken, verificationCode string) (u *UserT, err error) {
    accessToken, err := consumer.AuthorizeToken(requestToken, verificationCode)
    if err != nil {log.Fatal(err)}
    response, err := consumer.Get("https://api.twitter.com/1.1/account/verify_credentials.json", nil, accessToken)
    if err != nil {log.Fatal(err)}
    defer response.Body.Close()
    b, err := ioutil.ReadAll(response.Body)
    err = json.Unmarshal(b, &u)

This line:

requestToken := *oauth.RequestToken{Token:req.Oauth_token, Secret:""}

translated literally says “create an instance of oauth.RequestToken, then attempt to dereference it as a pointer.” i.e. it is attempting to perform an indirect (pointer) access via a literal struct value.

Instead, you want to create the instance and take its address (&), yielding a pointer-to-RequestToken, *oauth.RequestToken:

requestToken := &oauth.RequestToken{Token:req.Oauth_token, Secret:""}

Alternatively, you could create the token as a local value, then pass it by address to the TwitterApi function:

requestToken := oauth.RequestToken{Token:req.Oauth_token, Secret:""}

b, err := TwitterApi(&requestToken, req.Oauth_verifier)