From a8d543bea7f3332c3e6311b6bfc840632c75c850 Mon Sep 17 00:00:00 2001
From: Kevin Lyda <kevin@ie.suberic.net>
Date: Wed, 8 Aug 2018 14:46:14 +0100
Subject: [PATCH] Make this work for go 1.9 and reduces code.

---
 server/auth/microsoft/microsoft.go | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/server/auth/microsoft/microsoft.go b/server/auth/microsoft/microsoft.go
index 38336f64..576cbe3b 100644
--- a/server/auth/microsoft/microsoft.go
+++ b/server/auth/microsoft/microsoft.go
@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"errors"
 	"net/http"
+	"path"
 	"strings"
 
 	"github.com/nsheridan/cashier/server/auth"
@@ -67,12 +68,8 @@ func (c *Config) newClient(token *oauth2.Token) *http.Client {
 // Gets a response for an graph api call.
 func (c *Config) getDocument(token *oauth2.Token, pathElements ...string) map[string]interface{} {
 	client := c.newClient(token)
-	var url strings.Builder
-	url.WriteString("https://graph.microsoft.com/v1.0")
-	for _, pathElement := range pathElements {
-		url.WriteString(pathElement)
-	}
-	resp, err := client.Get(url.String())
+	url := "https://" + path.Join("graph.microsoft.com/v1.0", path.Join(pathElements...))
+	resp, err := client.Get(url)
 	if err != nil {
 		return nil
 	}
-- 
GitLab