Unable to list buckets in Storj using golang

Hi!

I have 2 questions:

  1. What is the difference between Storj V3 and Storj RC 1.0 ?

  2. I am currently trying to list the Storj RC 1.0 buckets using golang, but I am unable to do so.

My code is:

package main

import (
//	"bytes"
	"context"
	"fmt"
//	"io"
//	"io/ioutil"
	"log"

	"storj.io/uplink"
)

const (
	myAPIKey = "............."

	satellite    = "(Some URL)"
	myBucket     = "....."
	myUploadKey  = "......."
	myData       = "one fish two fish red fish blue fish"
	myPassphrase = "......."
)

// UploadAndDownloadData uploads the specified data to the specified key in the
// specified bucket, using the specified Satellite, API key, and passphrase.
func UploadAndDownloadData(ctx context.Context,
	satelliteAddress, apiKey, passphrase, bucketName, uploadKey string,
	dataToUpload []byte) error {

	// Request access grant to the satellite with the API key and passphrase.
	access, err := uplink.RequestAccessWithPassphrase(ctx, satelliteAddress, apiKey, passphrase)
	if err != nil {
		return fmt.Errorf("could not request access grant: %v", err)
	}

	// Open up the Project we will be working with.
	project, err := uplink.OpenProject(ctx, access)
	if err != nil {
		return fmt.Errorf("could not open project: %v", err)
	}
	defer project.Close()

	//////////////////////////////////////////////////////////
	list := project.ListBuckets(ctx, nil)
	fmt.Println(list.Item())
	//////////////////////////////////////////////////////////
	
	
	return nil
}

func main() {
	err := UploadAndDownloadData(context.Background(),
		satellite, myAPIKey, myPassphrase, myBucket, myUploadKey, []byte(myData))
	if err != nil {
		log.Fatalln("error:", err)
	}

	fmt.Println("success!")
}

I am getting the output:
<nil>

Please help
Thanks

Storj V3 refers to the third generation of the Storj network. There have been 3 iterations of the network with 3 versions of the white paper. The first version was the prototype that proved the viability of the concept of decentralized cloud storage. The second generation network launched in 2017 and operated though December of 2019. The second generation proved the viability of operating a decentralized cloud storage platform at scale.

We announced the production launch third generation network just a few weeks ago. The V3 network is an enterprise-grade, highly scalable cloud storage platform with comparable availability and durability to traditional cloud storage solutions, and superior privacy, security and economics.

During development of the V3 network, the three different peer classes in the network shared a single code repository. With the production release, we’re separating the peer classes into separate repos with different open source licenses, starting with the uplink. We’re tagging the separate repos with the 1.0 release to signify the official production release version. The 1.0 release also indicates that future releases will be backwards compatible to the 1.0 version.

While all of the software is open source and anyone can run any of the peer classes in the network, we
provide access to the network for developers to store data under the Tardigrade.io brand. The Tardigrade branded satellites are operated by Storj Labs and offer cloud storage backed by our SLA.

In regards to your Go question, you’ll want to iterate over the values and check for errors.

    list := project.ListBuckets(ctx, nil)
    for list.Next() {
    	fmt.Println(list.Item())
    }
    if list.Err() != nil {
    	return list.Err()
    }
1 Like