Trouble migrating to golang v112

Hi,

My site went offline and I am having trouble migrating my site to golang version 112.

How do I migrate this code from “appengine/urlfetch” to “net/http”.

func myHandler(w http.ResponseWriter, r *http.Request) {

some code…

}

// code that doesn’t work below

// Get URL request
ctx := appengine.NewContext( r )
client := urlfetch.Client(ctx)

Many thanks :smiley:

I managed to fix the site with a bit of googling and trial and error. I haven’t updated the site for over 3 years so I was a bit rusty on the golang and using google cloud services.

Migrating the URL request code from urlfetch to net/http was the easy part but I also had to sign up for billing in google cloud which is ok as I get a free credit every month and the site doesn’t use much. Once I did that the site worked.

The most confusing part was that I was trying to get the import appengine command to work as per the instructions I found online but I could not deploy the site and I found that I no longer need to import appegine so just get rid of it…

import {
           "other stuff.."
           //"google.golang.org/appengine"
          }

I just had to change this.

            //// OLD CODE
			//// Get URL request
			//ctx := appengine.NewContext(r)
			//client := urlfetch.Client(ctx)
			//resp, err := client.Get(req.URL.String())
			
			//// golang 1.13
			resp, err := http.Get(req.URL.String())

Also a few changes to the app.yaml file et el, instructions that can be found online.