I'm trying to create a presigned url using the aws-sdk-go, but it it's failing with the following output:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x138d40a]
goroutine 1 [running]:
github.com/aws/aws-sdk-go/service/s3.New(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/me/go/src/github.com/aws/aws-sdk-go/service/s3/service.go:47 +0x3a
main.main()
/Users/me/go/src/Test/main.go:22 +0xa0
exit status 2
I'm not seeing where I'm making a mistake, perhaps someone more experience in go could point out to me:
package main
import (
"fmt"
"log"
"time"
// "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/kelseyhightower/envconfig"
)
func main() {
var configuration s3.PutObjectInput
err := envconfig.Process("configuration", &configuration)
if err != nil {
log.Fatal(err.Error())
}
svc := s3.New(nil)
req, _ := svc.PutObjectRequest(&configuration)
url, err := req.Presign(15 * time.Minute)
fmt.Println("The url is ", url)
}