add chdir so files are at root of dir
This commit is contained in:
parent
bfc0370549
commit
34945e3003
12
scan.go
12
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))
|
url := fmt.Sprintf("http://127.0.0.1:8000/subscriber/%s/%s/manifest/upload", string(tideliftYML.TeamName), string(tideliftYML.RepositoryName))
|
||||||
// TODO: Add revision
|
// TODO: Add revision
|
||||||
|
|
||||||
var body = map[string]string{
|
var body = map[string][]string{
|
||||||
// maybe use httpclient.addFormFile and do everything manually...
|
// maybe use httpclient.addFormFile and do everything manually...
|
||||||
// https://github.com/ddliu/go-httpclient/blob/master/httpclient.go#L676
|
// 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,
|
"Authorization": auth,
|
||||||
}).Post(url, body)
|
}).Post(url, body)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
|
os.Chdir(cwd)
|
||||||
|
|
||||||
fmt.Println(body)
|
fmt.Println(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user