Fix some quality issues (#1914)

* Add .deepsource.toml

* Fix unnecessary typecasting on `bytes.Buffer`

* Fix check for empty string

* Replace nested if block with else-if

* Replace nested if block with else-if

* Replaced string.Replace() with string.ReplaceAll where n<0

* Remove deepsource toml file

Signed-off-by: siddhant-deepsource <siddhant@deepsource.io>

Co-authored-by: DeepSource Bot <bot@deepsource.io>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
Siddhant N Trivedi
2021-01-10 00:09:21 +05:30
committed by GitHub
parent fcc2fea684
commit cf35b8021c
5 changed files with 18 additions and 22 deletions

View File

@@ -6812,7 +6812,7 @@ func runtimeSyntaxZshYaml() (*asset, error) {
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
cannonicalName := strings.ReplaceAll(name, "\\", "/")
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
@@ -6838,7 +6838,7 @@ func MustAsset(name string) []byte {
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
cannonicalName := strings.ReplaceAll(name, "\\", "/")
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
@@ -7198,8 +7198,8 @@ var _bindata = map[string]func() (*asset, error){
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if name != "" {
cannonicalName := strings.ReplaceAll(name, "\\", "/")
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
@@ -7620,6 +7620,6 @@ func RestoreAssets(dir, name string) error {
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
cannonicalName := strings.ReplaceAll(name, "\\", "/")
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}