func (g *Path) SetURL(u *url.URL) error {
	switch {
	case u == nil:
		return errors.New("nil url")
	case u.Scheme != "gs" && u.Scheme != "" && u.Scheme != "file":
		return fmt.Errorf("must use a gs://, file://, or local filesystem url: %s", u)
	case strings.Contains(u.Host, ":"):
		return fmt.Errorf("gs://bucket may not contain a port: %s", u)
	case u.Opaque != "":
		return fmt.Errorf("url must start with gs://: %s", u)
	case u.User != nil:
		return fmt.Errorf("gs://bucket may not contain an user@ prefix: %s", u)
	case u.RawQuery != "":
		return fmt.Errorf("gs:// url may not contain a ?query suffix: %s", u)
	case u.Fragment != "":
		return fmt.Errorf("gs:// url may not contain a #fragment suffix: %s", u)
	}
	g.url = *u
	return nil
}
SetURL updates value to the passed in gs://bucket/obj url
package gcs
import (
	"bytes"
	"compress/zlib"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"hash/crc32"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
	"strings"
	statepb "github.com/GoogleCloudPlatform/testgrid/pb/state"
	"cloud.google.com/go/storage"
	"github.com/golang/protobuf/proto"
	"google.golang.org/api/googleapi"
	"google.golang.org/api/option"
)
func IsPreconditionFailed(err error) bool {
	if err == nil {
		return false
	}
	var e *googleapi.Error
	if !errors.As(err, &e) {
		return false
	}
	return e.Code == http.StatusPreconditionFailed
}
func ClientWithCreds(ctx context.Context, creds ...string) (*storage.Client, error) {
	var options []option.ClientOption
	switch l := len(creds); l {
	case 0:  
	case 1:
		options = append(options, option.WithCredentialsFile(creds[0]))
	default:
		return nil, fmt.Errorf("%d creds files unsupported (at most 1)", l)
	}
	return storage.NewClient(ctx, options...)
}
type Path struct {
	url url.URL
}
func NewPath(path string) (*Path, error) {
	var p Path
	err := p.Set(path)
	if err != nil {
		return nil, err
	}
	return &p, nil
}
func (g Path) String() string {
	return g.url.String()
}
func (g Path) URL() url.URL {
	return g.url
}
func (g *Path) Set(v string) error {
	u, err := url.Parse(v)
	if err != nil {
		return fmt.Errorf("invalid gs:// url %s: %v", v, err)
	}
	return g.SetURL(u)
}