fix: address linter issues in docs/drive commands
- Fix variable shadowing in DocsUpdateCmd (govet: shadow) - Extract formatAuto constant to satisfy goconst linter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
44673ff169
commit
ffa8631b52
@ -424,7 +424,8 @@ func (c *DocsUpdateCmd) Run(ctx context.Context, kctx *kong.Context, flags *Root
|
||||
|
||||
insertIndex := c.Index
|
||||
if insertIndex <= 0 {
|
||||
doc, err := svc.Documents.Get(id).
|
||||
var doc *docs.Document
|
||||
doc, err = svc.Documents.Get(id).
|
||||
Fields("documentId,body/content(startIndex,endIndex)").
|
||||
Context(ctx).
|
||||
Do()
|
||||
|
||||
@ -52,6 +52,7 @@ const (
|
||||
extPNG = ".png"
|
||||
extTXT = ".txt"
|
||||
|
||||
formatAuto = "auto"
|
||||
driveShareToAnyone = "anyone"
|
||||
driveShareToUser = "user"
|
||||
driveShareToDomain = "domain"
|
||||
@ -1121,7 +1122,7 @@ func guessMimeType(path string) string {
|
||||
func downloadDriveFile(ctx context.Context, svc *drive.Service, meta *drive.File, destPath string, format string) (string, int64, error) {
|
||||
isGoogleDoc := strings.HasPrefix(meta.MimeType, "application/vnd.google-apps.")
|
||||
normalizedFormat := strings.ToLower(strings.TrimSpace(format))
|
||||
if normalizedFormat == "auto" {
|
||||
if normalizedFormat == formatAuto {
|
||||
normalizedFormat = ""
|
||||
}
|
||||
|
||||
@ -1244,7 +1245,7 @@ func driveExportMimeType(googleMimeType string) string {
|
||||
|
||||
func driveExportMimeTypeForFormat(googleMimeType string, format string) (string, error) {
|
||||
format = strings.ToLower(strings.TrimSpace(format))
|
||||
if format == "" || format == "auto" {
|
||||
if format == "" || format == formatAuto {
|
||||
return driveExportMimeType(googleMimeType), nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user