我是刚来Golang的新手,希望将csv文件上载到一个网站,其中包含客户端api\u密钥bucket文件夹。是否有一个Golang解决方案?我正在通过Golang创建csv文件

这是curl请求

curl --location -- request POST 'https://drivex-service.sample.com/report/api/upload' \
-- hearder 'Cookie: '89825f9123456fa0' \
-- form 'Client_api_key=vfBM-zrfumyh9WUTKGbQ=' \
-- form 'bucket=bucket1' \
-- form 'folder=ROLE/YES/FOLDER' \
-- form 'files[]=@/D:/User/example.csv' 

下面是python post请求

def drivex_upload(file_obj):
        data = {
            "folder": 'ROLE/YES/FOLDER',
            "client_api_key": 'vfBM-zrfumyh9WUTKGbQ=',
            "bucket": 'bucket1'
        }
        headers = {
            "Accept": "application/json",
            "ContentType": "multipart/form-data"
        }
        files = {
            "files[]": file_obj
        }
        
        r = requests.post(
            self.upload_url,
            data=data,
            files=files,
            headers=headers,
            verify=False,
        )
        
        if r.status_code == 200:
            json_data = r.json()
            return r, None
        else:
            return r, "error while uploading"

我在Golang中尝试了以下操作(不使用Multipass),但不确定将客户端api密钥、存储桶和文件夹放在何处

file, err := os.Create(fileName)
if err != nil {
    log.Fatal(err)
}
defer file.Close()
writer := csv.NewWriter(file)
defer writer.Flush()
// define column headers
// write column headers
writer.Write(headers)
for key := range m {
    r := make([]string, 0, 1+len(headers))
    r = append(r, m.field1,m.field2,m.field3)
    writer.Write(r)
  }
req, err := http.NewRequest("POST", "https://drivex-service.sample.com/report/api/upload", file)
if err != nil {
    log.Fatal(err)
}
req.Header.Set("Accept", "application/json")

将感谢您的帮助,在建设一个工作戈朗邮政要求这一点