How to implement authorization_code grant flow in golang to login to Azure AD

I would like to implement authorization grant flow for an application in golang. The app will then read (delegated) azure resources the user has access to.

Already combed through several dozens of samples in github and everywhere else, but they are either incomplete or doesn’t bring up the login prompt as expected.

I am looking for a sample that uses purely REST (preferable). If not, using adal/msal, “golang.org/x/oauth2/microsoft” or any other method. Also need to get an access token from the request as the Go sdk for Azure doesnt cover all resources and I’d like to use the access token to make REST calls.

enter image description here

Any pointers to working code sample would be highly appreciated. Note: I can successfully login with other methods like client credentials. Issue is only getting auth code flow to work.

Thank you.