From 0cbc25c9b19e2a77340db73906311e9ec490e48b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 7 Nov 2024 07:54:17 +0100 Subject: [PATCH] fix: Harmonize style of comments Signed-off-by: Steffen Vogel --- .github/workflows/release.yaml | 2 +- .goreleaser.yaml | 4 +++- cmd/main.go | 8 +++---- cmd/static_embed.go | 2 +- cmd/static_local.go | 2 +- default.nix | 16 +++++++++++++ flake.nix | 1 + frontend/css/index.scss | 2 +- frontend/webpack.common.js | 8 +++---- pkg/config/config.go | 44 +++++++++++++++++----------------- pkg/handlers/complete.go | 8 +++---- pkg/handlers/config.go | 2 +- pkg/handlers/download.go | 4 ++-- pkg/handlers/initiate.go | 18 +++++++------- pkg/handlers/part.go | 2 +- pkg/notifier/notifier.go | 6 ++--- pkg/server/list.go | 6 ++--- pkg/server/retryer.go | 4 ++-- pkg/server/server.go | 10 ++++---- pkg/server/setup.go | 10 ++++---- pkg/shortener/shortener.go | 6 ++--- pkg/utils/env.go | 2 +- pkg/utils/etag.go | 4 ++-- 23 files changed, 95 insertions(+), 76 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d43c843..6d164b0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -53,6 +53,6 @@ jobs: with: distribution: goreleaser version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c61b55f..df56339 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,6 +1,8 @@ # SPDX-FileCopyrightText: 2023 Steffen Vogel # SPDX-License-Identifier: Apache-2.0 +version: 2 + project_name: gose before: @@ -39,7 +41,7 @@ checksum: name_template: 'checksums.txt' snapshot: - name_template: "{{ incpatch .Version }}-next" + version_template: "{{ incpatch .Version }}-next" changelog: sort: asc diff --git a/cmd/main.go b/cmd/main.go index f705201..f49d573 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -29,10 +29,10 @@ var ( const apiBase = "/api/v1" func main() { - log.Printf("GoSƐ %s, commit %s, built at %s by %s", version, commit, date, builtBy) + log.Printf("GoSƐ %s, commit %s, built at %s by %s\n", version, commit, date, builtBy) // Generate our config based on the config supplied - // by the user in the flags + // by the user in the flags. cfgFile, err := config.ParseFlags() if err != nil { log.Fatal(err) @@ -43,11 +43,11 @@ func main() { log.Fatal(err) } - // Run the server + // Run the server. run(cfg) } -// APIMiddleware will add the db connection to the context +// APIMiddleware will add the db connection to the context. func APIMiddleware(svrs server.List, shortener *shortener.Shortener, cfg *config.Config) gin.HandlerFunc { return func(c *gin.Context) { c.Set("servers", svrs) diff --git a/cmd/static_embed.go b/cmd/static_embed.go index 46b31d2..f53f12e 100644 --- a/cmd/static_embed.go +++ b/cmd/static_embed.go @@ -38,7 +38,7 @@ func embedFolder(fsEmbed embed.FS, targetPath string) static.ServeFileSystem { } } -// StaticMiddleware serves static assets package by Webpack +// StaticMiddleware serves static assets package by Webpack. func StaticMiddleware(cfg *config.Config) gin.HandlerFunc { return static.Serve("/", embedFolder(frontend.Files, "dist")) } diff --git a/cmd/static_local.go b/cmd/static_local.go index 7e4fd0c..2066ea5 100644 --- a/cmd/static_local.go +++ b/cmd/static_local.go @@ -11,7 +11,7 @@ import ( "github.com/stv0g/gose/pkg/config" ) -// StaticMiddleware serves static assets package by Webpack +// StaticMiddleware serves static assets package by Webpack. func StaticMiddleware(cfg *config.Config) gin.HandlerFunc { return static.Serve("/", static.LocalFile(cfg.Static, false)) } diff --git a/default.nix b/default.nix index 3123d0b..44dca47 100644 --- a/default.nix +++ b/default.nix @@ -35,8 +35,24 @@ buildGoModule { mv $out/bin/cmd $out/bin/gose ''; + tags = [ "embed" ]; + + ldflags = [ + "-s" + "-w" + "-X" + "main.version=${version}" + "-X" + "main.builtBy=Nix" + ]; + checkFlags = "-skip TestShortener"; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + doInstallCheck = true; + prePatch = '' ln -s ${frontend} frontend/dist ''; diff --git a/flake.nix b/flake.nix index 5d868a1..6e9ee61 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,7 @@ golangci-lint reuse nodejs_22 + goreleaser ]; }; diff --git a/frontend/css/index.scss b/frontend/css/index.scss index 69849f7..984c441 100644 --- a/frontend/css/index.scss +++ b/frontend/css/index.scss @@ -20,7 +20,7 @@ $color-dragzone: #eb71a0; } .logo { - margin-left: 2em; // Aligns goose feet with title text + margin-left: 2em; // Aligns goose feet with title text. max-width: 40%; } diff --git a/frontend/webpack.common.js b/frontend/webpack.common.js index d4df340..9e2e8f0 100644 --- a/frontend/webpack.common.js +++ b/frontend/webpack.common.js @@ -40,13 +40,13 @@ module.exports = { use: [ MiniCssExtractPlugin.loader, { - loader: "css-loader", // translates CSS into CommonJS modules + loader: "css-loader", // Translates CSS into CommonJS modules. }, { - loader: "postcss-loader", // Run post css actions + loader: "postcss-loader", // Run post CSS actions. options: { postcssOptions: { - plugins() { // post css plugins, can be exported to postcss.config.js + plugins() { // Post CSS plugins, can be exported to postcss.config.js return [ require("precss"), require("autoprefixer") @@ -56,7 +56,7 @@ module.exports = { }, }, { - loader: "sass-loader" // compiles Sass to CSS + loader: "sass-loader" // Compiles Sass to CSS. } ] }, diff --git a/pkg/config/config.go b/pkg/config/config.go index 527c911..ac64d78 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -20,20 +20,20 @@ const ( // MinPartSize is the minimally supported part size for an S3 multi-part upload part. MinPartSize size = 5 << 20 // 5MiB - // DefaultPartSize is the default size of the chunks used for Multi-part Upload if not provided by the configuration + // DefaultPartSize is the default size of the chunks used for Multi-part Upload if not provided by the configuration. DefaultPartSize size = 16 << 20 // 16MiB - // DefaultMaxUploadSize is the maximum upload size if not provided by the configuration + // DefaultMaxUploadSize is the maximum upload size if not provided by the configuration. DefaultMaxUploadSize size = 1 << 40 // 1TiB - // DefaultRegion is the default S3 region if not provided by the configuration + // DefaultRegion is the default S3 region if not provided by the configuration. DefaultRegion = "us-east-1" - // DefaultBucket is the default S3 bucket name to use if not provided by the configuration + // DefaultBucket is the default S3 bucket name to use if not provided by the configuration. DefaultBucket = "gose-uploads" ) -// DefaultExpiration is list of default expiration classes +// DefaultExpiration is list of default expiration classes. var DefaultExpiration = []Expiration{ { ID: "1day", @@ -69,7 +69,7 @@ func (s *size) UnmarshalText(text []byte) error { return nil } -// Expiration describes how long files are kept before getting deleted +// Expiration describes how long files are kept before getting deleted. type Expiration struct { ID string `json:"id" yaml:"id"` Title string `json:"title" yaml:"title"` @@ -77,7 +77,7 @@ type Expiration struct { Days int64 `json:"days" yaml:"days"` } -// S3ServerConfig is the public part of S3Server +// S3ServerConfig is the public part of S3Server. type S3ServerConfig struct { ID string `json:"id" yaml:"id"` Title string `json:"title" yaml:"title"` @@ -88,7 +88,7 @@ type S3ServerConfig struct { Expiration []Expiration `json:"expiration" yaml:"expiration"` } -// S3ServerSetup describes initial configuration for an S3 server/bucket +// S3ServerSetup describes initial configuration for an S3 server/bucket. type S3ServerSetup struct { Bucket bool `json:"bucket" yaml:"bucket"` CORS bool `json:"cors" yaml:"cors"` @@ -98,7 +98,7 @@ type S3ServerSetup struct { // S3Server describes an S3 server type S3Server struct { - // S3ServerConfig is the public info about an S3 server shared with the frontend + // S3ServerConfig is the public info about an S3 server shared with the frontend. S3ServerConfig `json:",squash"` Endpoint string `json:"endpoint" yaml:"endpoint"` @@ -112,14 +112,14 @@ type S3Server struct { Setup S3ServerSetup `json:"setup" yaml:"setup"` } -// ShortenerConfig contains Link-shortener specific configuration +// ShortenerConfig contains Link-shortener specific configuration. type ShortenerConfig struct { Endpoint string `json:"endpoint" yaml:"endpoint"` Method string `json:"method" yaml:"method"` Response string `json:"response" yaml:"response"` } -// NotificationConfig contains notification specific configuration +// NotificationConfig contains notification specific configuration. type NotificationConfig struct { URLs []string `json:"urls" yaml:"urls"` Template string `json:"template" yaml:"template"` @@ -133,32 +133,32 @@ type NotificationConfig struct { } `json:"mail" yaml:"mail"` } -// Config contains the main configuration +// Config contains the main configuration. type Config struct { *viper.Viper `json:"-" yaml:"-"` - // Default or single server config values + // Default or single server config values. S3Server `json:",squash" yaml:"default"` - // Multiple server config values + // Multiple server config values. Servers []S3Server `json:"servers" yaml:"servers,omitempty"` - // Host is the local machine IP Address to bind the HTTP Server to + // Host is the local machine IP Address to bind the HTTP Server to. Listen string `json:"listen" yaml:"listen,omitempty"` - // Directory of frontend assets if not bundled + // Directory of frontend assets if not bundled. Static string `json:"static" yaml:"static,omitempty"` - // BaseURL at which Gose is accessible + // BaseURL at which Gose is accessible. BaseURL string `json:"base_url" yaml:"base_url,omitempty"` Shortener *ShortenerConfig `json:"shortener" yaml:"shortener,omitempty"` Notification *NotificationConfig `json:"notification" yaml:"notification,omitempty"` } -// NewConfig returns a new decoded Config struct +// NewConfig returns a new decoded Config struct. func NewConfig(configFile string) (*Config, error) { - // Create cfg structure + // Create config structure. cfg := &Config{ Viper: viper.New(), } @@ -207,12 +207,12 @@ func NewConfig(configFile string) (*Config, error) { return nil, fmt.Errorf("failed to unmarshal config: %w", err) } - // Use the default values as the single server if no others are configured + // Use the default values as the single server if no others are configured. if len(cfg.Servers) == 0 { cfg.Servers = append(cfg.Servers, cfg.S3Server) } - // Some normalization and default values for servers + // Some normalization and default values for servers. for i := range cfg.Servers { svr := &cfg.Servers[i] @@ -273,7 +273,7 @@ func (c *Config) Check() error { } // ParseFlags will create and parse the CLI flags -// and return the path to be used elsewhere +// and return the path to be used elsewhere. func ParseFlags() (string, error) { // String that contains the configured configuration path var configPath string diff --git a/pkg/handlers/complete.go b/pkg/handlers/complete.go index 508b7bb..a4eb8de 100644 --- a/pkg/handlers/complete.go +++ b/pkg/handlers/complete.go @@ -33,7 +33,7 @@ type completionResponse struct { URL string `json:"url"` } -// HandleComplete handles a completed upload +// HandleComplete handles a completed upload. func HandleComplete(c *gin.Context) { svrs := c.MustGet("servers").(server.List) cfg := c.MustGet("config").(*config.Config) @@ -75,7 +75,7 @@ func HandleComplete(c *gin.Context) { return } - // Prepare MPU completion request + // Prepare MPU completion request. parts := []*s3.CompletedPart{} for _, part := range req.Parts { parts = append(parts, &s3.CompletedPart{ @@ -116,7 +116,7 @@ func HandleComplete(c *gin.Context) { } } - // Retrieve meta-data + // Retrieve meta-data. obj, err := svr.HeadObject(&s3.HeadObjectInput{ Bucket: aws.String(svr.Config.Bucket), Key: aws.String(req.ETag), @@ -133,7 +133,7 @@ func HandleComplete(c *gin.Context) { url = svr.GetObjectURL(req.ETag).String() } - // Send notifications + // Send notifications. go func(key string) { if cfg.Notification != nil && cfg.Notification.Uploads { if notif, err := notifier.NewNotifier(cfg.Notification.Template, cfg.Notification.URLs...); err != nil { diff --git a/pkg/handlers/config.go b/pkg/handlers/config.go index 2d20711..6e91efd 100644 --- a/pkg/handlers/config.go +++ b/pkg/handlers/config.go @@ -27,7 +27,7 @@ type configResponse struct { Features featureResponse `json:"features"` } -// HandleConfigWith returns runtime configuration to the frontend +// HandleConfigWith returns runtime configuration to the frontend. func HandleConfigWith(version, commit, date string) func(*gin.Context) { return func(c *gin.Context) { cfg := c.MustGet("config").(*config.Config) diff --git a/pkg/handlers/download.go b/pkg/handlers/download.go index ba24f30..e6d34bb 100644 --- a/pkg/handlers/download.go +++ b/pkg/handlers/download.go @@ -20,7 +20,7 @@ import ( "github.com/vfaronov/httpheader" ) -// HandleDownload handles a request for downloading a file +// HandleDownload handles a request for downloading a file. func HandleDownload(c *gin.Context) { var err error @@ -42,7 +42,7 @@ func HandleDownload(c *gin.Context) { return } - // Retrieve meta-data + // Retrieve meta-data. obj, err := svr.HeadObject(&s3.HeadObjectInput{ Bucket: aws.String(svr.Config.Bucket), Key: aws.String(etag), diff --git a/pkg/handlers/initiate.go b/pkg/handlers/initiate.go index 8311e2b..6666938 100644 --- a/pkg/handlers/initiate.go +++ b/pkg/handlers/initiate.go @@ -20,7 +20,7 @@ import ( ) const ( - // MaxFileNameLength is the maximum file length which can be uploaded + // MaxFileNameLength is the maximum file length which can be uploaded. MaxFileNameLength = 256 ) @@ -38,13 +38,13 @@ type initiateResponse struct { // We do not have a URL for resumed uploads due to limitations of the S3 API. URL string `json:"url,omitempty"` - // An empty UploadID indicate that the file already existed + // An empty UploadID indicate that the file already existed. UploadID string `json:"upload_id,omitempty"` Parts []part `json:"parts"` } -// HandleInitiate initiates a new upload +// HandleInitiate initiates a new upload. func HandleInitiate(c *gin.Context) { var err error @@ -87,7 +87,7 @@ func HandleInitiate(c *gin.Context) { Parts: []part{}, } - // Check if an object with this key already exists + // Check if an object with this key already exists. respObj, err := svr.HeadObject(&s3.HeadObjectInput{ Bucket: aws.String(svr.Config.Bucket), Key: aws.String(resp.ETag), @@ -96,14 +96,14 @@ func HandleInitiate(c *gin.Context) { u, _ := url.Parse(cfg.BaseURL) u.Path += filepath.Join("api/v1/download", req.Server, resp.ETag, req.FileName) - // Object already exists + // Object already exists. if err == nil { if req.ShortURL { origShortURL, okURL := respObj.Metadata["Original-Short-Url"] origFileName, okName := respObj.Metadata["Original-Filename"] if okName && okURL && req.FileName == *origFileName { - // This file is uploaded with the same name - // So we can reuse the already shortened link + // This file is uploaded with the same name. + // So we can reuse the already shortened link. resp.URL = *origShortURL } else { if shortener == nil { @@ -122,7 +122,7 @@ func HandleInitiate(c *gin.Context) { resp.URL = u.String() } } else { - // Check if an upload has already been started + // Check if an upload has already been started. respUploads, err := svr.ListMultipartUploads(&s3.ListMultipartUploadsInput{ Bucket: aws.String(svr.Config.Bucket), Prefix: aws.String(resp.ETag), @@ -161,7 +161,7 @@ func HandleInitiate(c *gin.Context) { "Original-Filename": req.FileName, } - // Shorten link + // Shorten link. if req.ShortURL { if shortener == nil { c.JSON(http.StatusBadRequest, gin.H{"error": "shortened URL requested but nut supported"}) diff --git a/pkg/handlers/part.go b/pkg/handlers/part.go index 6d91fa1..18affa6 100644 --- a/pkg/handlers/part.go +++ b/pkg/handlers/part.go @@ -57,7 +57,7 @@ func HandlePart(c *gin.Context) { return } - // For creating PutObject presigned URLs + // For creating PutObject presigned URLs. partReq, _ := svr.UploadPartRequest(&s3.UploadPartInput{ Bucket: aws.String(svr.Config.Bucket), Key: aws.String(req.ETag), diff --git a/pkg/notifier/notifier.go b/pkg/notifier/notifier.go index 35b3e98..9225fd5 100644 --- a/pkg/notifier/notifier.go +++ b/pkg/notifier/notifier.go @@ -34,14 +34,14 @@ type notifierArgs struct { UploadDate time.Time } -// Notifier sends notifications via various channels +// Notifier sends notifications via various channels. type Notifier struct { *router.ServiceRouter template *template.Template } -// NewNotifier creates a new notifier instance +// NewNotifier creates a new notifier instance. func NewNotifier(tpl string, urls ...string) (*Notifier, error) { sender, err := shoutrrr.CreateSender(urls...) if err != nil { @@ -61,7 +61,7 @@ func NewNotifier(tpl string, urls ...string) (*Notifier, error) { }, nil } -// Notify sends a notification +// Notify sends a notification. func (n *Notifier) Notify(url string, obj *s3.HeadObjectOutput, params types.Params) error { env, err := utils.EnvToMap() if err != nil { diff --git a/pkg/server/list.go b/pkg/server/list.go index d901b3a..6932049 100644 --- a/pkg/server/list.go +++ b/pkg/server/list.go @@ -11,10 +11,10 @@ import ( "github.com/stv0g/gose/pkg/config" ) -// List is a list of Servers +// List is a list of servers. type List map[string]Server -// NewList creates a new server list +// NewList creates a new server list. func NewList(svrs []config.S3Server) List { svcs := List{} sess := session.Must(session.NewSession()) @@ -37,7 +37,7 @@ func NewList(svrs []config.S3Server) List { return svcs } -// Setup initialize all servers in the list +// Setup initialize all servers in the list. func (sl List) Setup() error { for _, svc := range sl { if err := svc.Setup(); err != nil { diff --git a/pkg/server/retryer.go b/pkg/server/retryer.go index 74adc4a..889b0b6 100644 --- a/pkg/server/retryer.go +++ b/pkg/server/retryer.go @@ -18,8 +18,8 @@ func (d retryer) RetryRules(r *request.Request) time.Duration { ra := r.HTTPResponse.Header.Get("Retry-after") svr := r.HTTPResponse.Header.Get("Server") - // MinIO returns a "Retry-after: 120" header when the server is still initializing - // Waiting 120 seconds is far too long as most servers finish their initialization faster + // MinIO returns a "Retry-after: 120" header when the server is still initializing. + // Waiting 120 seconds is far too long as most servers finish their initialization faster. // We reduce the time to 1 second and let the other retry rules handle the rest. if ra != "" && svr == "MinIO" && r.HTTPResponse.StatusCode == 503 { r.HTTPResponse.Header.Set("Retry-after", "1") diff --git a/pkg/server/server.go b/pkg/server/server.go index 78c4c3a..dec27ea 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -21,14 +21,14 @@ const ( ImplementationUnknown = "Unknown" ) -// Server is a abstraction of an S3 server/bucket +// Server is a abstraction of an S3 server/bucket. type Server struct { *s3.S3 Config *config.S3Server } -// GetURL returns the full endpoint URL of the S3 server +// GetURL returns the full endpoint URL of the S3 server. func (s *Server) GetURL() *url.URL { u := &url.URL{} @@ -49,7 +49,7 @@ func (s *Server) GetURL() *url.URL { return u } -// GetObjectURL returns the full URL to an object based on its key +// GetObjectURL returns the full URL to an object based on its key. func (s *Server) GetObjectURL(key string) *url.URL { u := s.GetURL() u.Path += "/" + key @@ -57,7 +57,7 @@ func (s *Server) GetObjectURL(key string) *url.URL { return u } -// GetExpirationClass gets the expiration class by name +// GetExpirationClass gets the expiration class by name. func (s *Server) GetExpirationClass(cls string) *config.Expiration { for _, c := range s.Config.Expiration { if c.ID == cls { @@ -92,7 +92,7 @@ func (s *Server) DetectImplementation() string { } } -// Healthy returns true if the S3 server is reachable and responds to our authenticated requests +// Healthy returns true if the S3 server is reachable and responds to our authenticated requests. func (s *Server) Healthy() bool { _, err := s.S3.ListObjects(&s3.ListObjectsInput{ Bucket: aws.String(s.Config.Bucket), diff --git a/pkg/server/setup.go b/pkg/server/setup.go index 7c4c4d9..b7d78d4 100644 --- a/pkg/server/setup.go +++ b/pkg/server/setup.go @@ -12,7 +12,7 @@ import ( "github.com/aws/aws-sdk-go/service/s3" ) -// Setup initializes the S3 bucket (life-cycle rules & CORS) +// Setup initializes the S3 bucket (life-cycle rules & CORS). func (s *Server) Setup() error { if s.Config.Implementation == "" { s.Config.Implementation = s.DetectImplementation() @@ -21,13 +21,13 @@ func (s *Server) Setup() error { log.Printf("Using %s S3 implementation for server %s", s.Config.Implementation, s.GetURL()) } - // MinIO does not support the setup of bucket CORS rules and MPU abortion lifecycle + // MinIO does not support the setup of bucket CORS rules and MPU abortion lifecycle. if s.Config.Implementation == ImplementationMinio { s.Config.Setup.CORS = false s.Config.Setup.AbortIncompleteUploads = 0 } - // Create bucket if it does not exist yet + // Create bucket if it does not exist yet. if _, err := s.GetBucketPolicy(&s3.GetBucketPolicyInput{ Bucket: aws.String(s.Config.Bucket), }); err != nil { @@ -40,7 +40,7 @@ func (s *Server) Setup() error { } } - // Set CORS configuration for bucket + // Set CORS configuration for bucket. if s.Config.Setup.CORS { corsRule := &s3.CORSRule{ AllowedHeaders: aws.StringSlice([]string{"Authorization"}), @@ -63,7 +63,7 @@ func (s *Server) Setup() error { } if s.Config.Setup.Lifecycle { - // Create lifecycle policies + // Create lifecycle policies. lcRules := []*s3.LifecycleRule{} if s.Config.Setup.AbortIncompleteUploads > 0 { diff --git a/pkg/shortener/shortener.go b/pkg/shortener/shortener.go index cadf498..cd88f54 100644 --- a/pkg/shortener/shortener.go +++ b/pkg/shortener/shortener.go @@ -16,7 +16,7 @@ import ( "github.com/stv0g/gose/pkg/utils" ) -// Shortener is an URL shortener instance +// Shortener is an URL shortener instance. type Shortener struct { config.ShortenerConfig } @@ -27,7 +27,7 @@ type shortenerArgs struct { Env map[string]string } -// NewShortener creates a new URL shortener instance +// NewShortener creates a new URL shortener instance. func NewShortener(c *config.ShortenerConfig) (*Shortener, error) { s := new(Shortener) @@ -66,7 +66,7 @@ func (s *Shortener) getRequest(u string) (*http.Request, error) { return http.NewRequest(s.Method, tplURL, nil) } -// Shorten shorten a passed long URL into a short one using the shortener service +// Shorten shorten a passed long URL into a short one using the shortener service. func (s *Shortener) Shorten(long *url.URL) (*url.URL, error) { req, err := s.getRequest(long.String()) if err != nil { diff --git a/pkg/utils/env.go b/pkg/utils/env.go index 03fd430..8cb8a8e 100644 --- a/pkg/utils/env.go +++ b/pkg/utils/env.go @@ -8,7 +8,7 @@ import ( "strings" ) -// EnvToMap returns the current set of environment variables as a map +// EnvToMap returns the current set of environment variables as a map. func EnvToMap() (map[string]string, error) { envMap := make(map[string]string) var err error diff --git a/pkg/utils/etag.go b/pkg/utils/etag.go index c567b21..ed70e45 100644 --- a/pkg/utils/etag.go +++ b/pkg/utils/etag.go @@ -11,11 +11,11 @@ import ( ) const ( - // MaxPartCount is the maximum number of parts for a MPU + // MaxPartCount is the maximum number of parts for a MPU. MaxPartCount = 10000 ) -// IsValidETag check is an ETag is valid as generated/accepted by AWS-S3 +// IsValidETag check is an ETag is valid as generated/accepted by AWS-S3. func IsValidETag(et string) bool { p := strings.SplitN(et, "-", 2)