From 34945e3003862dd63632f7ca03b5ab987d8c9b67 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Thu, 16 May 2019 08:47:19 -0400 Subject: [PATCH] add chdir so files are at root of dir --- scan.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scan.go b/scan.go index f4fb0ad..d35c214 100644 --- a/scan.go +++ b/scan.go @@ -15,17 +15,23 @@ func upload(directory string) { url := fmt.Sprintf("http://127.0.0.1:8000/subscriber/%s/%s/manifest/upload", string(tideliftYML.TeamName), string(tideliftYML.RepositoryName)) // TODO: Add revision - var body = map[string]string{ + var body = map[string][]string{ // maybe use httpclient.addFormFile and do everything manually... // https://github.com/ddliu/go-httpclient/blob/master/httpclient.go#L676 - "@files[]": fileNames[0], // TODO: Add multiple files + "@files[]": fileNames, } - _, err := httpclient.WithHeaders(map[string]string{ + cwd, err := os.Getwd() + check(err) + os.Chdir(directory) + + _, err = httpclient.WithHeaders(map[string]string{ "Authorization": auth, }).Post(url, body) check(err) + os.Chdir(cwd) + fmt.Println(body) }