diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 85209410..ef15fd91 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -170,7 +170,7 @@ jobs: name: Build binary env: VERSION: ${{ env.TEST_VERSION }} - run: make build-darwin-amd64 + run: make build-darwin-arm64 - name: Integration tests run: make test-integration diff --git a/go.mod b/go.mod index 34691106..dd4c7ac8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/wakatime/wakatime-cli -go 1.22.2 +go 1.22.3 require ( github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 diff --git a/pkg/heartbeat/format.go b/pkg/heartbeat/format.go index 8e9aa8b3..378c63b8 100644 --- a/pkg/heartbeat/format.go +++ b/pkg/heartbeat/format.go @@ -34,7 +34,7 @@ func WithFormatting() HandleOption { } } -// Format accepts a heartbeat formats it's filepath and returns the formatted version. +// Format accepts a heartbeat to format its filepath and returns the formatted version. func Format(h Heartbeat) Heartbeat { if !h.IsUnsavedEntity && (runtime.GOOS != "windows" || !windows.IsWindowsNetworkMount(h.Entity)) { formatLinuxFilePath(&h) diff --git a/pkg/heartbeat/format_test.go b/pkg/heartbeat/format_test.go index f1a3f33f..3757cdd3 100644 --- a/pkg/heartbeat/format_test.go +++ b/pkg/heartbeat/format_test.go @@ -53,6 +53,26 @@ func TestWithFormatting(t *testing.T) { }, result) } +func TestFormat_WindowsUnixProjectPathOverride(t *testing.T) { + if runtime.GOOS != "windows" { + t.Skip("Skipping because OS is not windows.") + } + + h := heartbeat.Heartbeat{ + Entity: `C:\Users\project\main.go`, + EntityType: heartbeat.FileType, + ProjectPathOverride: "", + } + + r := heartbeat.Format(h) + + assert.Equal(t, heartbeat.Heartbeat{ + Entity: `C:/Users/project/main.go`, + EntityType: heartbeat.FileType, + ProjectPathOverride: "", + }, r) +} + func TestFormat_NetworkMount(t *testing.T) { if runtime.GOOS != "windows" { t.Skip("Skipping because OS is not windows.") diff --git a/pkg/windows/windows.go b/pkg/windows/windows.go index 8b6c2c86..6c25a2d6 100644 --- a/pkg/windows/windows.go +++ b/pkg/windows/windows.go @@ -39,7 +39,7 @@ var ( // FormatFilePath formats a windows filepath by converting backslash to // frontslash and ensuring that drive letter is upper case. func FormatFilePath(fp string) string { - isWindowsNetworkMount := windowsNetworkMountRegex.MatchString(fp) + isWindowsNetworkMount := IsWindowsNetworkMount(fp) fp = backslashReplaceRegex.ReplaceAllString(fp, "/")