mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
config/module: fix test failures on Windows
When parsing URLs on Windows, assume it is a drive letter path if the second element is a ':' character. Format the drive letter path as a "file:///"-path prior to parsing the URL. Fixes test failures of the following form in command on Windows: === RUN TestApply_plan --- FAIL: TestApply_plan (0.00s) apply_test.go:379: bad: 1 module download not supported for scheme 'c'
This commit is contained in:
parent
b40c2fe997
commit
65177edd1e
@ -9,9 +9,14 @@ import (
|
|||||||
|
|
||||||
func urlParse(rawURL string) (*url.URL, error) {
|
func urlParse(rawURL string) (*url.URL, error) {
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
|
if len(rawURL) > 1 && rawURL[1] == ':' {
|
||||||
|
// Assume we're dealing with a file path.
|
||||||
|
rawURL = fmtFileURL(rawURL)
|
||||||
|
} else {
|
||||||
// Make sure we're using "/" on Windows. URLs are "/"-based.
|
// Make sure we're using "/" on Windows. URLs are "/"-based.
|
||||||
rawURL = filepath.ToSlash(rawURL)
|
rawURL = filepath.ToSlash(rawURL)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
u, err := url.Parse(rawURL)
|
u, err := url.Parse(rawURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user