Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: Reformat using the new gofmt #3143

Merged
merged 1 commit into from Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions aws/aws.go
Expand Up @@ -77,10 +77,10 @@ func (co ConfigOverrider) ClientConfig(serviceName string, cfgs ...*aws.Config)
// ConfigFromURLParams.
//
// The following query options are supported:
// - region: The AWS region for requests; sets aws.Config.Region.
// - endpoint: The endpoint URL (hostname only or fully qualified URI); sets aws.Config.Endpoint.
// - disableSSL: A value of "true" disables SSL when sending requests; sets aws.Config.DisableSSL.
// - s3ForcePathStyle: A value of "true" forces the request to use path-style addressing; sets aws.Config.S3ForcePathStyle.
// - region: The AWS region for requests; sets aws.Config.Region.
// - endpoint: The endpoint URL (hostname only or fully qualified URI); sets aws.Config.Endpoint.
// - disableSSL: A value of "true" disables SSL when sending requests; sets aws.Config.DisableSSL.
// - s3ForcePathStyle: A value of "true" forces the request to use path-style addressing; sets aws.Config.S3ForcePathStyle.
func ConfigFromURLParams(q url.Values) (*aws.Config, error) {
var cfg aws.Config
for param, values := range q {
Expand Down Expand Up @@ -119,8 +119,8 @@ func ConfigFromURLParams(q url.Values) (*aws.Config, error) {
// parameters it knows about
//
// The following query options are supported:
// - profile: The AWS profile to use from the AWS configs (shared config file and
// shared credentials file)
// - profile: The AWS profile to use from the AWS configs (shared config file and
// shared credentials file)
func NewSessionFromURLParams(q url.Values) (*session.Session, url.Values, error) {
// always enable shared config (~/.aws/config by default)
opts := session.Options{SharedConfigState: session.SharedConfigEnable}
Expand Down Expand Up @@ -175,8 +175,8 @@ func NewDefaultV2Config(ctx context.Context) (awsv2.Config, error) {
// V2ConfigFromURLParams.
//
// The following query options are supported:
// - region: The AWS region for requests; sets WithRegion.
// - profile: The shared config profile to use; sets SharedConfigProfile.
// - region: The AWS region for requests; sets WithRegion.
// - profile: The shared config profile to use; sets SharedConfigProfile.
func V2ConfigFromURLParams(ctx context.Context, q url.Values) (awsv2.Config, error) {
var opts []func(*awsv2cfg.LoadOptions) error
for param, values := range q {
Expand Down
52 changes: 26 additions & 26 deletions blob/azureblob/azureblob.go
Expand Up @@ -20,7 +20,7 @@
// set to "BlockBlob".
// See https://stackoverflow.com/questions/37824136/put-on-sas-blob-url-without-specifying-x-ms-blob-type-header.
//
// URLs
// # URLs
//
// For blob.OpenBucket, azureblob registers for the scheme "azblob".
// The default URL opener will use credentials from the environment variables
Expand All @@ -37,34 +37,34 @@
// see URLOpener.
// See https://gocloud.dev/concepts/urls/ for background information.
//
// Escaping
// # Escaping
//
// Go CDK supports all UTF-8 strings; to make this work with services lacking
// full UTF-8 support, strings must be escaped (during writes) and unescaped
// (during reads). The following escapes are performed for azureblob:
// - Blob keys: ASCII characters 0-31, 92 ("\"), and 127 are escaped to
// "__0x<hex>__". Additionally, the "/" in "../" and a trailing "/" in a
// key (e.g., "foo/") are escaped in the same way.
// - Metadata keys: Per https://docs.microsoft.com/en-us/azure/storage/blobs/storage-properties-metadata,
// Azure only allows C# identifiers as metadata keys. Therefore, characters
// other than "[a-z][A-z][0-9]_" are escaped using "__0x<hex>__". In addition,
// characters "[0-9]" are escaped when they start the string.
// URL encoding would not work since "%" is not valid.
// - Metadata values: Escaped using URL encoding.
// - Blob keys: ASCII characters 0-31, 92 ("\"), and 127 are escaped to
// "__0x<hex>__". Additionally, the "/" in "../" and a trailing "/" in a
// key (e.g., "foo/") are escaped in the same way.
// - Metadata keys: Per https://docs.microsoft.com/en-us/azure/storage/blobs/storage-properties-metadata,
// Azure only allows C# identifiers as metadata keys. Therefore, characters
// other than "[a-z][A-z][0-9]_" are escaped using "__0x<hex>__". In addition,
// characters "[0-9]" are escaped when they start the string.
// URL encoding would not work since "%" is not valid.
// - Metadata values: Escaped using URL encoding.
//
// As
// # As
//
// azureblob exposes the following types for As:
// - Bucket: *azblob.ContainerURL
// - Error: azblob.StorageError
// - ListObject: azblob.BlobItemInternal for objects, azblob.BlobPrefix for "directories"
// - ListOptions.BeforeList: *azblob.ListBlobsSegmentOptions
// - Reader: azblob.DownloadResponse
// - Reader.BeforeRead: *azblob.BlockBlobURL, *azblob.BlobAccessConditions
// - Attributes: azblob.BlobGetPropertiesResponse
// - CopyOptions.BeforeCopy: azblob.Metadata, *azblob.ModifiedAccessConditions, *azblob.BlobAccessConditions
// - WriterOptions.BeforeWrite: *azblob.UploadStreamToBlockBlobOptions
// - SignedURLOptions.BeforeSign: *azblob.BlobSASSignatureValues
// - Bucket: *azblob.ContainerURL
// - Error: azblob.StorageError
// - ListObject: azblob.BlobItemInternal for objects, azblob.BlobPrefix for "directories"
// - ListOptions.BeforeList: *azblob.ListBlobsSegmentOptions
// - Reader: azblob.DownloadResponse
// - Reader.BeforeRead: *azblob.BlockBlobURL, *azblob.BlobAccessConditions
// - Attributes: azblob.BlobGetPropertiesResponse
// - CopyOptions.BeforeCopy: azblob.Metadata, *azblob.ModifiedAccessConditions, *azblob.BlobAccessConditions
// - WriterOptions.BeforeWrite: *azblob.UploadStreamToBlockBlobOptions
// - SignedURLOptions.BeforeSign: *azblob.BlobSASSignatureValues
package azureblob

import (
Expand Down Expand Up @@ -207,10 +207,10 @@ const Scheme = "azblob"
// The URL host is used as the bucket name.
//
// The following query options are supported:
// - domain: The domain name used to access the Azure Blob storage (e.g. blob.core.windows.net)
// - protocol: The protocol to use (e.g., http or https; default to https)
// - cdn: Set to true when domain represents a CDN
// - localemu: Set to true when domain points to the Local Storage Emulator (Azurite)
// - domain: The domain name used to access the Azure Blob storage (e.g. blob.core.windows.net)
// - protocol: The protocol to use (e.g., http or https; default to https)
// - cdn: Set to true when domain represents a CDN
// - localemu: Set to true when domain points to the Local Storage Emulator (Azurite)
//
// See Options for more details.
type URLOpener struct {
Expand Down
29 changes: 14 additions & 15 deletions blob/blob.go
Expand Up @@ -18,8 +18,7 @@
//
// See https://gocloud.dev/howto/blob/ for a detailed how-to guide.
//
//
// Errors
// # Errors
//
// The errors returned from this package can be inspected in several ways:
//
Expand All @@ -29,20 +28,20 @@
// The Bucket.ErrorAs method can retrieve the driver error underlying the returned
// error.
//
//
// OpenCensus Integration
// # OpenCensus Integration
//
// OpenCensus supports tracing and metric collection for multiple languages and
// backend providers. See https://opencensus.io.
//
// This API collects OpenCensus traces and metrics for the following methods:
// - Attributes
// - Copy
// - Delete
// - ListPage
// - NewRangeReader, from creation until the call to Close. (NewReader and ReadAll
// are included because they call NewRangeReader.)
// - NewWriter, from creation until the call to Close.
// - Attributes
// - Copy
// - Delete
// - ListPage
// - NewRangeReader, from creation until the call to Close. (NewReader and ReadAll
// are included because they call NewRangeReader.)
// - NewWriter, from creation until the call to Close.
//
// All trace and metric names begin with the package import path.
// The traces add the method name.
// For example, "gocloud.dev/blob/Attributes".
Expand All @@ -52,8 +51,8 @@
// For example, "gocloud.dev/blob/latency".
//
// It also collects the following metrics:
// - gocloud.dev/blob/bytes_read: the total number of bytes read, by driver.
// - gocloud.dev/blob/bytes_written: the total number of bytes written, by driver.
// - gocloud.dev/blob/bytes_read: the total number of bytes read, by driver.
// - gocloud.dev/blob/bytes_written: the total number of bytes written, by driver.
//
// To enable trace collection in your application, see "Configure Exporter" at
// https://opencensus.io/quickstart/go/tracing.
Expand Down Expand Up @@ -1309,9 +1308,9 @@ func DefaultURLMux() *URLMux {
// the following query parameters:
//
// - prefix: wraps the resulting Bucket using PrefixedBucket with the
// given prefix.
// given prefix.
// - key: wraps the resulting Bucket using SingleKeyBucket with the
// given key.
// given key.
func OpenBucket(ctx context.Context, urlstr string) (*Bucket, error) {
return defaultURLMux.OpenBucket(ctx, urlstr)
}
Expand Down
12 changes: 7 additions & 5 deletions blob/drivertest/bindata.go
Expand Up @@ -99,11 +99,13 @@ var _bindata = map[string]func() ([]byte, error){
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
//
// data/
// foo.txt
// img/
// a.png
// b.png
//
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
Expand Down
17 changes: 12 additions & 5 deletions blob/drivertest/drivertest.go
Expand Up @@ -71,16 +71,23 @@ type HarnessMaker func(ctx context.Context, t *testing.T) (Harness, error)
// 2. Creates a blob in a directory, using BeforeWrite as a WriterOption.
// 3. Fetches the blob's attributes and calls AttributeCheck.
// 4. Creates a Reader for the blob using BeforeReader as a ReaderOption,
// and calls ReaderCheck with the resulting Reader.
//
// and calls ReaderCheck with the resulting Reader.
//
// 5. Calls List using BeforeList as a ListOption, with Delimiter set so
// that only the directory is returned, and calls ListObjectCheck
// on the single directory list entry returned.
//
// that only the directory is returned, and calls ListObjectCheck
// on the single directory list entry returned.
//
// 6. Calls List using BeforeList as a ListOption, and calls ListObjectCheck
// on the single blob entry returned.
//
// on the single blob entry returned.
//
// 7. Tries to read a non-existent blob, and calls ErrorCheck with the error.
// 8. Makes a copy of the blob, using BeforeCopy as a CopyOption.
// 9. Calls SignedURL using BeforeSign as a SignedURLOption for each supported
// signing method (i.e. GET, PUT and DELETE).
//
// signing method (i.e. GET, PUT and DELETE).
//
// For example, an AsTest might set a driver-specific field to a custom
// value in BeforeWrite, and then verify the custom value was returned in
Expand Down
60 changes: 30 additions & 30 deletions blob/fileblob/fileblob.go
Expand Up @@ -23,35 +23,35 @@
// In any case, absent any stored metadata many blob.Attributes fields
// will be set to default values.
//
// URLs
// # URLs
//
// For blob.OpenBucket, fileblob registers for the scheme "file".
// To customize the URL opener, or for more details on the URL format,
// see URLOpener.
// See https://gocloud.dev/concepts/urls/ for background information.
//
// Escaping
// # Escaping
//
// Go CDK supports all UTF-8 strings; to make this work with services lacking
// full UTF-8 support, strings must be escaped (during writes) and unescaped
// (during reads). The following escapes are performed for fileblob:
// - Blob keys: ASCII characters 0-31 are escaped to "__0x<hex>__".
// If os.PathSeparator != "/", it is also escaped.
// Additionally, the "/" in "../", the trailing "/" in "//", and a trailing
// "/" is key names are escaped in the same way.
// On Windows, the characters "<>:"|?*" are also escaped.
// - Blob keys: ASCII characters 0-31 are escaped to "__0x<hex>__".
// If os.PathSeparator != "/", it is also escaped.
// Additionally, the "/" in "../", the trailing "/" in "//", and a trailing
// "/" is key names are escaped in the same way.
// On Windows, the characters "<>:"|?*" are also escaped.
//
// As
// # As
//
// fileblob exposes the following types for As:
// - Bucket: os.FileInfo
// - Error: *os.PathError
// - ListObject: os.FileInfo
// - Reader: io.Reader
// - ReaderOptions.BeforeRead: *os.File
// - Attributes: os.FileInfo
// - CopyOptions.BeforeCopy: *os.File
// - WriterOptions.BeforeWrite: *os.File
// - Bucket: os.FileInfo
// - Error: *os.PathError
// - ListObject: os.FileInfo
// - Reader: io.Reader
// - ReaderOptions.BeforeRead: *os.File
// - Attributes: os.FileInfo
// - CopyOptions.BeforeCopy: *os.File
// - WriterOptions.BeforeWrite: *os.File
package fileblob // import "gocloud.dev/blob/fileblob"

import (
Expand Down Expand Up @@ -110,20 +110,20 @@ const Scheme = "file"
//
// If either of base_url / secret_key_path are provided, both must be.
//
// - file:///a/directory
// -> Passes "/a/directory" to OpenBucket.
// - file://localhost/a/directory
// -> Also passes "/a/directory".
// - file://./../..
// -> The hostname is ".", signaling a relative path; passes "../..".
// - file:///c:/foo/bar on Windows.
// -> Passes "c:\foo\bar".
// - file://localhost/c:/foo/bar on Windows.
// -> Also passes "c:\foo\bar".
// - file:///a/directory?base_url=/show&secret_key_path=secret.key
// -> Passes "/a/directory" to OpenBucket, and sets Options.URLSigner
// to a URLSignerHMAC initialized with base URL "/show" and secret key
// bytes read from the file "secret.key".
// - file:///a/directory
// -> Passes "/a/directory" to OpenBucket.
// - file://localhost/a/directory
// -> Also passes "/a/directory".
// - file://./../..
// -> The hostname is ".", signaling a relative path; passes "../..".
// - file:///c:/foo/bar on Windows.
// -> Passes "c:\foo\bar".
// - file://localhost/c:/foo/bar on Windows.
// -> Also passes "c:\foo\bar".
// - file:///a/directory?base_url=/show&secret_key_path=secret.key
// -> Passes "/a/directory" to OpenBucket, and sets Options.URLSigner
// to a URLSignerHMAC initialized with base URL "/show" and secret key
// bytes read from the file "secret.key".
type URLOpener struct {
// Options specifies the default options to pass to OpenBucket.
Options Options
Expand Down
30 changes: 15 additions & 15 deletions blob/gcsblob/gcsblob.go
Expand Up @@ -15,7 +15,7 @@
// Package gcsblob provides a blob implementation that uses GCS. Use OpenBucket
// to construct a *blob.Bucket.
//
// URLs
// # URLs
//
// For blob.OpenBucket, gcsblob registers for the scheme "gs".
// The default URL opener will set up a connection using default credentials
Expand All @@ -32,27 +32,27 @@
// see URLOpener.
// See https://gocloud.dev/concepts/urls/ for background information.
//
// Escaping
// # Escaping
//
// Go CDK supports all UTF-8 strings; to make this work with services lacking
// full UTF-8 support, strings must be escaped (during writes) and unescaped
// (during reads). The following escapes are performed for gcsblob:
// - Blob keys: ASCII characters 10 and 13 are escaped to "__0x<hex>__".
// Additionally, the "/" in "../" is escaped in the same way.
// - Blob keys: ASCII characters 10 and 13 are escaped to "__0x<hex>__".
// Additionally, the "/" in "../" is escaped in the same way.
//
// As
// # As
//
// gcsblob exposes the following types for As:
// - Bucket: *storage.Client
// - Error: *googleapi.Error
// - ListObject: storage.ObjectAttrs
// - ListOptions.BeforeList: *storage.Query
// - Reader: *storage.Reader
// - ReaderOptions.BeforeRead: **storage.ObjectHandle, *storage.Reader (if accessing both, must be in that order)
// - Attributes: storage.ObjectAttrs
// - CopyOptions.BeforeCopy: *CopyObjectHandles, *storage.Copier (if accessing both, must be in that order)
// - WriterOptions.BeforeWrite: **storage.ObjectHandle, *storage.Writer (if accessing both, must be in that order)
// - SignedURLOptions.BeforeSign: *storage.SignedURLOptions
// - Bucket: *storage.Client
// - Error: *googleapi.Error
// - ListObject: storage.ObjectAttrs
// - ListOptions.BeforeList: *storage.Query
// - Reader: *storage.Reader
// - ReaderOptions.BeforeRead: **storage.ObjectHandle, *storage.Reader (if accessing both, must be in that order)
// - Attributes: storage.ObjectAttrs
// - CopyOptions.BeforeCopy: *CopyObjectHandles, *storage.Copier (if accessing both, must be in that order)
// - WriterOptions.BeforeWrite: **storage.ObjectHandle, *storage.Writer (if accessing both, must be in that order)
// - SignedURLOptions.BeforeSign: *storage.SignedURLOptions
package gcsblob // import "gocloud.dev/blob/gcsblob"

import (
Expand Down
4 changes: 2 additions & 2 deletions blob/memblob/memblob.go
Expand Up @@ -15,14 +15,14 @@
// Package memblob provides an in-memory blob implementation.
// Use OpenBucket to construct a *blob.Bucket.
//
// URLs
// # URLs
//
// For blob.OpenBucket memblob registers for the scheme "mem".
// To customize the URL opener, or for more details on the URL format,
// see URLOpener.
// See https://gocloud.dev/concepts/urls/ for background information.
//
// As
// # As
//
// memblob does not support any types for As.
package memblob // import "gocloud.dev/blob/memblob"
Expand Down