mirror of https://github.com/databricks/cli.git
Enable linter 'mirror' and autofix existing issues (#2070)
https://github.com/butuzov/mirror
This commit is contained in:
parent
39d1e8093f
commit
8e8399da83
|
@ -13,6 +13,7 @@ linters:
|
|||
- goimports
|
||||
- testifylint
|
||||
- intrange
|
||||
- mirror
|
||||
linters-settings:
|
||||
govet:
|
||||
enable-all: true
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
|
@ -67,7 +68,7 @@ func (m *importResource) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
|
|||
if changed && !m.opts.AutoApprove {
|
||||
output := buf.String()
|
||||
// Remove output starting from Warning until end of output
|
||||
output = output[:bytes.Index([]byte(output), []byte("Warning:"))]
|
||||
output = output[:strings.Index(output, "Warning:")]
|
||||
cmdio.LogString(ctx, output)
|
||||
|
||||
if !cmdio.IsPromptSupported(ctx) {
|
||||
|
|
|
@ -74,7 +74,7 @@ func makeIterator(count int) listing.Iterator[*provisioning.Workspace] {
|
|||
func makeBigOutput(count int) string {
|
||||
res := bytes.Buffer{}
|
||||
for _, ws := range makeWorkspaces(count) {
|
||||
res.Write([]byte(fmt.Sprintf("%d %s\n", ws.WorkspaceId, ws.WorkspaceName)))
|
||||
res.WriteString(fmt.Sprintf("%d %s\n", ws.WorkspaceId, ws.WorkspaceName))
|
||||
}
|
||||
return res.String()
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ func (w *WorkspaceFilesClient) Write(ctx context.Context, name string, reader io
|
|||
|
||||
// This API returns 400 if the file already exists, when the object type is notebook
|
||||
regex := regexp.MustCompile(`Path \((.*)\) already exists.`)
|
||||
if aerr.StatusCode == http.StatusBadRequest && regex.Match([]byte(aerr.Message)) {
|
||||
if aerr.StatusCode == http.StatusBadRequest && regex.MatchString(aerr.Message) {
|
||||
// Parse file path from regex capture group
|
||||
matches := regex.FindStringSubmatch(aerr.Message)
|
||||
if len(matches) == 2 {
|
||||
|
|
Loading…
Reference in New Issue