mirror of https://github.com/databricks/cli.git
Fix lint errors for using deprecated functionality (#35)
Functionality from `io/ioutil` has moved to the `io` and `os` packages in go1.16 ([reference](https://pkg.go.dev/io/ioutil)). Confirmed that staticcheck passes when run with: ``` staticcheck -checks SA1019 ./... ```
This commit is contained in:
parent
31a841ff33
commit
c00db56d84
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -28,7 +28,7 @@ func githubGetPAT(ctx context.Context) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
raw, err := ioutil.ReadAll(response.Body)
|
raw, err := io.ReadAll(response.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ func githubGetPAT(ctx context.Context) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return retries.Halt(err)
|
return retries.Halt(err)
|
||||||
}
|
}
|
||||||
raw, err := ioutil.ReadAll(response.Body)
|
raw, err := io.ReadAll(response.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return retries.Continuef("failed to read body: %w", err)
|
return retries.Continuef("failed to read body: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ func githubGetPAT(ctx context.Context) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
raw, _ = ioutil.ReadAll(response.Body)
|
raw, _ = io.ReadAll(response.Body)
|
||||||
log.Printf("[INFO] %s", raw)
|
log.Printf("[INFO] %s", raw)
|
||||||
// TODO: convert to PAT
|
// TODO: convert to PAT
|
||||||
return bearer, nil
|
return bearer, nil
|
||||||
|
|
|
@ -3,7 +3,6 @@ package git
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -45,7 +44,7 @@ func MustGetFileSet() FileSet {
|
||||||
|
|
||||||
func New(root string) FileSet {
|
func New(root string) FileSet {
|
||||||
lines := []string{".git"}
|
lines := []string{".git"}
|
||||||
rawIgnore, err := ioutil.ReadFile(fmt.Sprintf("%s/.gitignore", root))
|
rawIgnore, err := os.ReadFile(fmt.Sprintf("%s/.gitignore", root))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// add entries from .gitignore if the file exists (did read correctly)
|
// add entries from .gitignore if the file exists (did read correctly)
|
||||||
for _, line := range strings.Split(string(rawIgnore), "\n") {
|
for _, line := range strings.Split(string(rawIgnore), "\n") {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package project
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ func loadProjectConf() (prj Project, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
raw, err := ioutil.ReadAll(config)
|
raw, err := io.ReadAll(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue