diff --git a/database/pgsql/pgsql.go b/database/pgsql/pgsql.go index c849e12c..b29dad00 100644 --- a/database/pgsql/pgsql.go +++ b/database/pgsql/pgsql.go @@ -20,7 +20,7 @@ import ( "fmt" "io/ioutil" "net/url" - "path" + "path/filepath" "runtime" "strings" "time" @@ -218,7 +218,7 @@ func migrate(source string) error { log.Info("running database migrations") _, filename, _, _ := runtime.Caller(1) - migrationDir := path.Join(path.Dir(filename), "/migrations/") + migrationDir := filepath.Join(filepath.Dir(filename), "/migrations/") conf := &goose.DBConf{ MigrationsDir: migrationDir, Driver: goose.DBDriver{ diff --git a/database/pgsql/pgsql_test.go b/database/pgsql/pgsql_test.go index 2bde669d..58c516cc 100644 --- a/database/pgsql/pgsql_test.go +++ b/database/pgsql/pgsql_test.go @@ -17,7 +17,7 @@ package pgsql import ( "fmt" "os" - "path" + "path/filepath" "runtime" "strings" @@ -40,7 +40,7 @@ func generateTestConfig(testName string, loadFixture bool) config.RegistrableCom var fixturePath string if loadFixture { _, filename, _, _ := runtime.Caller(0) - fixturePath = path.Join(path.Dir(filename)) + "/testdata/data.sql" + fixturePath = filepath.Join(filepath.Dir(filename)) + "/testdata/data.sql" } source := fmt.Sprintf("postgresql://postgres@127.0.0.1:5432/%s?sslmode=disable", dbName) diff --git a/updater/fetchers/debian/debian_test.go b/updater/fetchers/debian/debian_test.go index 42e81d3c..e092909d 100644 --- a/updater/fetchers/debian/debian_test.go +++ b/updater/fetchers/debian/debian_test.go @@ -16,7 +16,7 @@ package debian import ( "os" - "path" + "path/filepath" "runtime" "testing" @@ -29,7 +29,7 @@ func TestDebianParser(t *testing.T) { _, filename, _, _ := runtime.Caller(0) // Test parsing testdata/fetcher_debian_test.json - testFile, _ := os.Open(path.Join(path.Dir(filename)) + "/testdata/fetcher_debian_test.json") + testFile, _ := os.Open(filepath.Join(filepath.Dir(filename)) + "/testdata/fetcher_debian_test.json") response, err := buildResponse(testFile, "") if assert.Nil(t, err) && assert.Len(t, response.Vulnerabilities, 3) { for _, vulnerability := range response.Vulnerabilities { diff --git a/updater/fetchers/rhel/rhel_test.go b/updater/fetchers/rhel/rhel_test.go index 90998c78..0e9ddbd0 100644 --- a/updater/fetchers/rhel/rhel_test.go +++ b/updater/fetchers/rhel/rhel_test.go @@ -16,7 +16,7 @@ package rhel import ( "os" - "path" + "path/filepath" "runtime" "testing" @@ -27,7 +27,7 @@ import ( func TestRHELParser(t *testing.T) { _, filename, _, _ := runtime.Caller(0) - path := path.Join(path.Dir(filename)) + path := filepath.Join(filepath.Dir(filename)) // Test parsing testdata/fetcher_rhel_test.1.xml testFile, _ := os.Open(path + "/testdata/fetcher_rhel_test.1.xml") diff --git a/updater/fetchers/ubuntu/ubuntu_test.go b/updater/fetchers/ubuntu/ubuntu_test.go index b12f8eaf..d76d457e 100644 --- a/updater/fetchers/ubuntu/ubuntu_test.go +++ b/updater/fetchers/ubuntu/ubuntu_test.go @@ -16,7 +16,7 @@ package ubuntu import ( "os" - "path" + "path/filepath" "runtime" "testing" @@ -27,7 +27,7 @@ import ( func TestUbuntuParser(t *testing.T) { _, filename, _, _ := runtime.Caller(0) - path := path.Join(path.Dir(filename)) + path := filepath.Join(filepath.Dir(filename)) // Test parsing testdata/fetcher_ testData, _ := os.Open(path + "/testdata/fetcher_ubuntu_test.txt") diff --git a/utils/utils_test.go b/utils/utils_test.go index bb4b0ede..57bfc9e0 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -17,7 +17,7 @@ package utils import ( "bytes" "os" - "path" + "path/filepath" "runtime" "testing" @@ -65,10 +65,10 @@ func TestString(t *testing.T) { func TestTar(t *testing.T) { var err error var data map[string][]byte - _, filepath, _, _ := runtime.Caller(0) + _, path, _, _ := runtime.Caller(0) testDataDir := "/testdata" for _, filename := range []string{"utils_test.tar.gz", "utils_test.tar.bz2", "utils_test.tar.xz", "utils_test.tar"} { - testArchivePath := path.Join(path.Dir(filepath), testDataDir, filename) + testArchivePath := filepath.Join(filepath.Dir(path), testDataDir, filename) // Extract non compressed data data, err = SelectivelyExtractArchive(bytes.NewReader([]byte("that string does not represent a tar or tar-gzip file")), "", []string{}, 0) diff --git a/worker/detectors/feature/test.go b/worker/detectors/feature/test.go index 186e714c..fe9f3d55 100644 --- a/worker/detectors/feature/test.go +++ b/worker/detectors/feature/test.go @@ -16,7 +16,7 @@ package feature import ( "io/ioutil" - "path" + "path/filepath" "runtime" "testing" @@ -32,7 +32,7 @@ type FeatureVersionTest struct { func LoadFileForTest(name string) []byte { _, filename, _, _ := runtime.Caller(0) - d, _ := ioutil.ReadFile(path.Join(path.Dir(filename)) + "/" + name) + d, _ := ioutil.ReadFile(filepath.Join(filepath.Dir(filename)) + "/" + name) return d } diff --git a/worker/worker_test.go b/worker/worker_test.go index e8d54608..31829e44 100644 --- a/worker/worker_test.go +++ b/worker/worker_test.go @@ -15,7 +15,7 @@ package worker import ( - "path" + "path/filepath" "runtime" "testing" @@ -45,7 +45,7 @@ func newMockDatastore() *mockDatastore { func TestProcessWithDistUpgrade(t *testing.T) { _, f, _, _ := runtime.Caller(0) - testDataPath := path.Join(path.Dir(f)) + "/testdata/DistUpgrade/" + testDataPath := filepath.Join(filepath.Dir(f)) + "/testdata/DistUpgrade/" // Create a mock datastore. datastore := newMockDatastore()