Go

Go

Made by DeepSource

Prefer filepath.Join instead of concatenating strings with os.PathSeparator GO-W4014

Bug risk
Minor
Autofix

path/filepath.Join takes care of removing leading and trailing separators and simplifying relative paths. This reduces the risk of path related bugs.

Bad practice

package main

import (
    "os"
)

func getPath(dir, file string) string {
    return dir + string(os.PathSeparator) + file
}

Recommended

package main

import (
    "path/filepath"
)

func getPath(dir, file string) string {
    return filepath.Join(dir, file)
}